ajax - My jQuery POST is not adding the body to the request? -


i trying send post jquery. here code:

        var s = {             "first_name": "jimi",             "last_name": "hendrix",             "rank": "boy scout",             "email": "jimi@gmail.com"         };         $.ajax({             type: 'post',             url: 'http://localhost:9000/scouts',             datatype: 'json',             data: {scout: s},             beforesend: function (request) {                 request.setrequestheader("access-control-allow-origin", "*");                 request.setrequestheader("content-type", "application/json");             }         }); 

but data not added request. network tab shows headers provisional , access-control-allow-origin not set either. here network tab: enter image description here why body not being attached? need set headers?

you ajax request has been blocked (there error in console).

access-control-allow-origin must set localhost:9000 not localhost:8080.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -