Hi,
I am trying to send data to a server(different domain) from client(browser). i.e client server interaction using JAVASCRIPT.
How do i do it?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Guest UserRank #259 · 9.8K reputationPosted Jul 14, 2014, 5:57 AM EDT
$http.post(...) in AngularJS
or
$.post(...) in jQuery
Server doesn't allow for cross domain requests, this is security breach. To do this, server should enable CORS (http://enable-cors.org/) OR use JSONP (http://en.wikipedia.org/wiki/JSONP)
twitter @sumitjolly
Pradeep ShetRank #595 · 4K reputationPosted Jul 14, 2014, 6:07 AM EDT
Raghavendra Joshi30 reputationPosted Jul 14, 2014, 9:08 PM EDT
Guest UserRank #259 · 9.8K reputationPosted Jul 15, 2014, 3:07 AM EDT
so, something like this is being returned by WebAPI
callbackFunc({ "firstName": "sumit", "lastName": "jolly" });
# We need to set callback and data type attributes of Ajax request
# Install the JSONP MediaTypeFormatter, use NuGet
twitter @sumitjolly