jquery - CORS AJAX domain rest request -
i have url returns xml data , uses url username , password.
$.ajax({ url: 'http://myserver.com:port/bc/rest/productslist/', data: { 'username': 'username', 'password': 'password' }, datatype: "jsonp", // cross domain contenttype: "application/xml; charset=utf-8", type: 'get', crossdomain: true, beforesend : function(xhr) { xhr.setrequestheader("authorization", "basic" + window.btoa("username" + ":"+ "password")); }, success: function(sucessresponse) { alert('put completed' + sucessresponse); } , error: function(failresponse){ alert("error: went wrong" + json.stringify(failresponse)); } });
problem: when testing code showing error:
uncaught syntaxerror: unexpected token <' error.
any suggestions? thanks
Comments
Post a Comment