i have this code and it always end up with error block. I spent four hours on searching but nothing helped. I want to load HTML data from a URL
$.ajax({
url: 'http://google.com',
//data: {action : 'login', formData : $('#check-user').serialize()},
dataType: 'html',
type: 'get',
async: 'false',
//contentType: 'application/json; charset=utf-8',
//dataType: 'json',
beforeSend: function(xhr) {
//xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
// This callback function will trigger before data is sent
//$.mobile.showPageLoadingMsg(true); // This will show ajax spinner
},
complete: function() {
// This callback function will trigger on data sent/received complete
// $.mobile.hidePageLoadingMsg(); // This will hide ajax spinner
},
success: function (result) {
alert(result);
if(result.status) {
//$.mobile.changePage("#second");
alert("Change Page");
} else {
alert('Logon unsuccessful!');
}
},
error: function (xhr, status, error) {
// This callback function will trigger on unsuccessful action
//var err = eval(xhr.responseText);
//alert(xhr.Message);
alert('Network error has occurred please try again! ' );
}
});