var getPageInhalt : function (id){
var restmethod = "http://localhost:1212/getPageById/"+id+"/jsonp.aspx?callback=?";
$.ajax({
url: restmethod,
type: "GET",
contentType: "application/json",
async: false,
dataType: 'jsonp',
cache: false,
error: function(){
return false;
},
success: function(data){
console.log(data); --> balblal
return data;
}
});
}
console.log(getPageInhalt(2));-->undefined ?????
var getPageInhalt : function (id){ var restmethod = http://localhost:1212/getPageById/+id+/jsonp.aspx?callback=?; $.ajax({ url: restmethod, type: GET,
Share
Although i disagree with synchronous AJAX (technically it is an oxymoron ..) you will have to return the value from the
getPageInhaltfunction and not from the ajax callbacks..Here is a demo http://jsfiddle.net/gaby/qHY7g/