<script type="text/javascript">
var fixed = 1;
var sizew = 122;
var sizeh = 160;
/*
* function crop()
* ajax function which returns the cropped image
*/
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)
$("#showPhoto").css({overflow:"auto"})
$("#showPhoto").html($(document.createElement("img")).attr("src",response.filename)).show();
$("#showPhoto").after("There you go...").show();
$("#image").slideUp();
}
});
}
</script>
<img id="loading" src="c/assets/loading.gif" style="display:none;">
<div id="showPhoto"></div>
<div id="image" style="display:none;">
<form action="" method="post" id="crop_details">
<input type="hidden" id="x" name="x" />
<input type="hidden" id="y" name="y" />
<input type="hidden" id="w" name="w" />
<input type="hidden" id="h" name="h" />
<input type="hidden" id="fname" name="fname" />
<input type="button" value="Crop Image" onclick="return crop();" />
</form>
</div>
<div id="upload">
<form id="form1" action="" method="post" enctype="multipart/form-data">
<input type="file" name="file" id="file">
<input type="button" id="buttonUpload" value="Upload Image" onClick="return ajaxFileUpload();" />
</form>
</div>
why doesnt it alert TEST when i run the function? It send the ajaxcall, and get the response.filename back, but it doesnt run anything in success? Not the alert "test" and neither the rest..
But.. it do work when im not including "top.php" at the top of the file.
But what could possibly interrupt this from running the success?
top.php is where it loads title, head javascripts and css files and some javascript functions
UPDATE I made a error handler, and now get this in Firebug:
get channel "({"filename":"1283548305.jpg"})"(RED)
get statusText "OK"(RED)
getResponseText "({"filename":"1283548305.jpg"})"(RED)
constructor(RED) function()
(RED) means that the text is red.. like thats the error i think.