JSONP request always throws error for sytax :
hi,
I have the below code , i am fetching the json using jsonp , since i need to use the values returned.
function logResults(json){
console.log(json);
}
var fetchProp = function () {
console.log ('[exwprop] > invoke fetchProp () method.') ;
$.ajax({
dataType: "jsonp",
url: "
http://localhost:8888/abc-samp-module-catalog/env",
jsonpCallback: "logResults",
type: 'get',
processData: false,
crossDomain: true,
ContentType: "application/json"
})/*
.done(function( data ) {
$.each( data.items, function( i, item ) {
console.log ('item ' +item) ;
});
})*/
.fail(function() {
console.log( "error" );
});
It runs and throws error "Uncaught SyntaxError: Unexpected token
: "
I see that the in the chrome developer tools the line
{"name":"
abc-samp-module-catalog","profiles":["env"],"label":"master","propertySources":[{"name":"file:///C:/GITLABCODE/
abc-samp-module-catalogsample/logging.properties","source":{"logging.level.SysBoundaryLogger":"DEBUG\t","logging.level.com":"DEBUG","logging.level.TimeLogger":"DEBUG","logging.level.org.springframework.context.annotation":"DEBUG"}},{"name":"file:///C:/GITLABCODE/f
abc-samp-module-catalog/sample/
abc-samp-module-catalog.yml","source":{"server.port":54350,"com.catalog.PModuleCatalogService.Variable":"Hello","spring.datasource.url":"jdbc:oracle:thin:@localhost:1521:xe","spring.datasource.username":"EXW","spring.datasource.password":"EXW","spring.datasource.driver-class-name":"oracle.jdbc.driver.OracleDriver","spring.datasource.continueOnError":false,"spring.datasource.initialize":true,"spring.jpa.database-platform":"org.hibernate.dialect.Oracle10gDialect"}}]}
Which is the json returned by the server call, but shows the
line below with the colon as in error. Since its a JSON response, i assume jquery can handle it. or Do i have to parse and print it .
{"name":"
abc-samp-module-catalog"