Jquery Ajax Request Return Forbidden (403) In Cakephp Project
EDIT 2 I still need help, as the error still isn't fixed. Below I have added a link to a screenshot of what .ajaxError() does throw: http://i.imgur.com/RkcgNtG.jpg Another thought
Solution 1:
I have now changed my jQuery Ajax-Call that looks like following
$.ajax({
url: '/metas/saveMetas',
data: {
"model": model,
"f_key": f_key,
"pagetitle": pagetitle,
"keywords": keywords,
"description": description,
"niceurl": niceurl
},
dataType: 'json',
complete: function(){
returnfalse;
},
success: function(result) {
if(typeof result =='object') {
$('#modal-spinner-seo-update').hide('slow');
jQuery.each(result, function(field, message) {
$('#seo-'+field).next('div.error-message').html(message).fadeIn('fast');
});
} else {
$('#modal-spinner-seo-update').hide('slow', function() {
$("#seo-widget-message-success").fadeIn('slow').delay(2000).fadeOut('slow');
});
}
returnfalse;
}
});
into a simple JavaScript xmlHttpRequest as following
xhr = newXMLHttpRequest();
xhr.onreadystatechange=function()
{
if (xhr.readyState==4 && xhr.status==200)
{
console.log(xhr.responseText);
if(typeof xhr.responseText =='object') {
$('#modal-spinner-seo-update').hide('slow');
jQuery.each(result, function(field, message) {
$('#seo-'+field).next('div.error-message').html(message).fadeIn('fast');
});
} else {
$('#modal-spinner-seo-update').hide('slow', function() {
$("#seo-widget-message-success").fadeIn('slow').delay(2000).fadeOut('slow');
});
}
returnfalse;
}
};
xhr.open('GET','/metas/saveMetas?model='+model+'&f_key='+f_key+'&pagetitle='+pagetitle+'&keywords='+keywords+'&description='+description+'&niceurl='+niceurl, true );
xhr.send();
and now everything seems to work fine. But I still do not understand why. Can anyone explain what I did wrong?
Post a Comment for "Jquery Ajax Request Return Forbidden (403) In Cakephp Project"