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: 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
Post a Comment