I am using this piece of code to get JSON data:-
function getData(){
$.ajax({
type:"GET",
dataType: "jsonp",
url: "http://localhost:8080/SpringFileUpload/service
/api/search?name=kop&query=java&smonth=0&emonth=200&key=7546323574194176&
zipcode=100001",
success: function(data) {
$("body").append(data);
},
error: function(jqXHR, textStatus, errorThrown) {
alert(jqXHR.status);
}
});}
This is my json data which i am getting
{"took":"36","totalHits":"1","hits":[{"index":"kop","type":"doc","id":"L-elA3tKQYShys0Tv7WamA","experience":"86","providedName":"My name","providedPhoneNumber":"+96384545","providedZipCode":"100001","uploadon":"29/07/15","source":null,"url":"file://./Profile1_Java_SOAPUI_JUNIT 15.doc","highlights":[" TestNG. Experience with scripting using Java, Groovy etc\nExtensively used SoapUI to test Web",": Jira, MantisBT, QC\nOperating Systems: Windows XP/2000, DOS\nProgramming Languages: Java, C and C"," automated test plan for the application using Jbehave , Selenium WebDriver and Java.\n\nPerformed GUI Testing","\n\n Environment: Selenium WebDriver, Jbehave, Java, JUnit , Firebug, Jira, MySQL, Eclipse, QC,Window 7"," using Java and Selenium Web driver.\n\nUsed Jira for Defect tracking and triaging.\nUse Maven for build"],"title":"Professional Objective","contentType":null}]}
I checked this JSON data here
It's a valid JSON data. But still my call is going to error. getting alert with 200 status and Uncaught SyntaxError: Unexpected token : in console. Please tell me what i am doing wrong here.
UPDATE:-