Nothing is wrong, as soon as i change the lib to 1.3.2 my on success stuff works just fine? How comes? Not even the alert with TEST appears..
Here's the code this is happening on:
function crop() {
$.ajax({
type: "POST",
dataType: 'json',
url:"functions.php?action=crop",
data:
{
x: $('#x').val(),y: $('#y').val(),w: $('#w').val(),
h: $('#h').val(),fname:$('#fname').val(),fixed:fixed,
sizew:sizew,sizeh:sizeh},
success: function(response)
{
alert('TEST');
if(!fixed) // Missing { }
{
$("#showPhoto").css({overflow:"auto"}); // Missing ;
}
$("#showPhoto").html(
$(document.createElement("img")).attr(
"src",response.filename)).show();
$("#showPhoto").after("There you go...").show();
$("#image").slideUp();
},
error:function(response) {
console.log('error: ', response);
}
});
}
How can i make it to work with jquery 1.4.2 library?
The JSON coming back isn't valid, the example you posted:
And the response I got in the page:
Both aren't valid JSON, you need to remove the
()
wrapper on there. You can check your JSON response for validity here: http://www.jsonlint.com/The 1.3.2 vs 1.4.2 difference is that in 1.4.0 jQuery added strict JSON checking, if it's not valid it'll fail (so it can take better advantage of browsers' native JSON parsers).
From the 1.4 release notes: