javascript - How to get response from RESTful API using ajax by Another Domain? -


i have used ajax code gives error "xmlhttprequest can not load" after using "access-control-allow-origin: '*'" in java script code gives error "unexpected error" . have searched on internet last 3-4 days not getting solution here guys please me solve problem .

this code:`

jquery.noconflict(); jquery(document).ready(function( $ ){  var encryptedtext = "hdeao+i4qk9umgylbhe490rfcqq"; new ajax.request('http://example.com/json/service', { access-control-allow-origin: '*', method: 'post',  contenttype: 'application/json',     postbody: '{"abc":{"request":'+encryptedtext+'}}', onsuccess: function(transport){ var myobject = eval('(' + transport.responsetext + ')');         alert("success");                },   onfailure : function(){         alert("fail");                 },         });     });` 

i have used prototype.js in project.

i don't have idea "access-control-allow-origin" code put in code please tell me .

please give me coding not theory guys because new in field.

i appreciate guys solve problem.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo