If I understood it right you are doing an XMLHttpRequest to a different domain than your page is on. So the browser is blocking it as it usually allows a request in the same origin for security reasons. You need to do something different when you want to do a cross-domain request. A tutorial about how to achieve that is Using CORS.
When you are using Postman they are not restricted by this policy. Quoted from Cross-Origin XMLHttpRequest:
Regular web pages can use the XMLHttpRequest object to send and receive data from remote servers, but they’re limited by the same origin policy. Extensions aren’t so limited. An extension can talk to remote servers outside of its origin, as long as it first requests cross-origin permissions.
Related Posts:
- Why does my JavaScript code receive a “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” error, while Postman does not?
- Cross-Origin Read Blocking (CORB)
- How do I link a JavaScript file to a HTML file?
- jQuery equivalent of JavaScript’s addEventListener method
- Adding an onclick function to go to url in JavaScript?
- Checking a Url in Jquery/Javascript
- Best way to store a key=>value array in JavaScript?
- JavaScript runtime error: ‘$’ is undefined
- When and why to ‘return false’ in JavaScript?
- JavaScript Loading Screen while page loads
- Format date to MM/dd/yyyy in JavaScript
- How is JavaScript .on() method defined?
- What’s the point of the X-Requested-With header?
- Javascript isnull
- JQuery: $.get is not a function
- How to get client’s IP address using JavaScript?
- Simple throttle in JavaScript
- How can I expand and collapse a using javascript?
- Javascript : array.length returns undefined
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- Add tinymce buttons to caption textarea in media uploader
- How to prevent wordpress from loading old versions of jquery in wp_head();?
- Add custom shortcode button to Editor
- RequireJS in custom theme. Working Example
- Infinite scroll / lazy loading with NextGen Gallery [closed]
- How to handle multiple instance of “send_to_editor” js function
- How to get a jQuery script to run on a page?
- Defer Parsing of Scripts
- Modify Custom Field in Media Library using JavaScript
- Asynchronous Javascript Loaders
- wp_enqueuescript won’t load in footer even with true value set?
- How to Use JSON With AJAX?
- Execution of JavaScript on save post
- Using wp_ajax and wp_ajax_nopriv hooks
- Prevent five different copies of jquery from being included on every page
- Hide/show customizer controls based on other settings in Customizer
- Is placing stuff in page text edit window bad form?
- javascript is not working on Event Submission?
- Add colorpicker to featured image
- jQuery Tree View and wp_list_pages
- WordPress audio player causing js error, mediaelementplayer is not a function
- Auto-detect javascript errors and warn theme user
- combining js scripts from a js newb [closed]
- Loading posts via AJAX in a hidden div with updated URL?
- Heartbeat API: How to access data already enqueued?
- Implementing lazy loading in homepage posts instead of pagination
- How to show jquery popup only in one page or once?
- Correct way to write jQuery functions in WordPress
- Using bootstrap-slider and bootstrap-switch in wordpress admin panel
- Trouble with WordPress Ajax Login System – 302
- Limit filetype and wp media
- How does WordPress handle HTML Tables interaction with jQuery
- Javascript stopped working [closed]
- Why load JS through the CMS framework? [duplicate]
- Problem passing id-specific objects to javascript via wp_localize_script
- url – ajax loaded but no JS
- Callback After WordPress Customizer Complete Loading
- Create special WordPress slideshow with “jquery.cycle.all.js”
- Close Fancybox, sumbit form data and redirect
- How to enque js script in footer that are not in .js file?
- Properly embed javascript into WP (using function.php) – doesn’t work?
- Nested Gallery Shortcode INTERMITTENTLY working
- Disable Cloudflare Rocket Loader for jQuery javascript and make it load first
- How to keep HTML form field that is conditional hidden with javasript hidden after page reload?
- Accessing javascript in multiple files [closed]
- Issues loading Jquery on WordPress website
- jQuery selectable() function won’t work in wordpress
- Custom AJAX form not working async
- Is it OK combined wp-include js, jquery, css? [closed]
- Including Older Version of jQuery for IE7/IE8
- Parse wordpress blog data using json api and ajax
- Problem adding MP3 attachments to a jPlayer playlist
- How To Include JavaScript Files Only In Single Posts?
- Ajax page load in wordpress the right way?
- Jquery not working
- A carousel slideshow plugin in JavaScript
- JS behavior differs depending on page tree [closed]
- How to use $ with externally loaded javascript
- Theme customisation – how to store javascript externally when it utilises php variables?
- jQuery for Fade Preload Causes My Site Favicon to Disappear from Tab of Browser
- Get ajaxForm response value
- why does so many javascript libraries are loaded along with my website?
- Why does my media selection script write to ONLY the first input field?
- onclick jquery function not working in wordpress header file [duplicate]
- Modify the href attribute of tag dynamically in WordPress
- Add a jQuery snippet for sepcific user role
- Adding scripts before plugins scripts
- Move jQuery on *top* of footer
- JQuery and Javascript to pan image
- jQuery search function not running in WordPress but running locally (fiddle)
- Masonry – Can’t Find Variable imagesLoaded
- How to get this jQuary script working?
- How to add JS snippet before closing tag?
- Clear custom field when new tag is added
- Are you sure popup on Contact Form 7 [closed]
- jQuery ajax empty exeption on wordpress
- javascript not loading in wordpress
- JS file not loading [closed]
- Carousel Hover Image
- How to Javascript/jQuery