how to call REST API from javascript

MacStims

New Member
I have a url which gives json data...I want to hit that URL from javascript but I am getting this error :character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signatureCode :\[code\]function a(){$.getJSON(url,function(data) { alert(data);});}\[/code\]full code :\[code\]<html lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" ></meta><script language="JavaScript" type="text/javascript" src="http://stackoverflow.com/questions/14433212/jquery-1.7.1.min.js"></script><script>function a(){$.getJSON(url,function(data) { alert(data);});}</script></head><body><input type="text"/><input type="submit" value="http://stackoverflow.com/questions/14433212/search" onclick="a()"/></body></html>\[/code\]
 
Back
Top