$.ajax( { url : 'http://site', data: {}, dataType:'jsonp', jsonpCallback: 'callbackName', type: 'post'
,success:function (data) {
console.log('ok');
},
error:function () {
console.log('error');
}
});
function getXMLHttp()
{
var xmlHttp
try
{
//Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
}catch(e){
//Internet Explorer
try{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
alert("Your browser does not support AJAX!")
return false;
}
}
}
return xmlHttp;
}
function MakeRequest(action, id)
{
lastAction = action;//alert(action + ' ' + id);
state = '';
divMakeReq = document.getElementById('makereq');
divMakeReq.innerHTML = 'Action:' + action +'; id:' + id;
divError = document.getElementById('err');
divError.innerHTML = '';
var xmlHttp = getXMLHttp();
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4)
{
if (xmlHttp.responseXML != null)
HandleResponse(action, id, xmlHttp.responseXML);
}
}
xmlHttp.open("GET", aLink+ "/action/"+action+"/"+id, true);
xmlHttp.send(null);
}