java - Access-Control-Allow-Origin for ajax call and HttpURLConnection -
I was trying to access a web-url (which is not accessible to me) that would return a JSON formatted string. / P>
I tried with AJAX calls and it shows that ' No access-control-permission-generating' header exists at the requested resource . Then I found an alternative solution to get JSON data using HttpURLConnection Can anyone tell me that both work , Because the requests have been made from the local host itself. Below is my code in both ways: AJAX: HttpURL connection: simply type
var request = $ .jg ({url} : "Url", type: "go", crossdaman: true, data: "content =" + component: list, data type: 'jason'});
URL obj = new URL (URL); HttpURLConnection con = (HttpURLConnection) obj.openConnection (); Con.setRequestMethod ("GET"); Int responsivecode = con.getResponseCode ();
data: ingredient list, Should have the format automatically
Comments
Post a Comment