我在 .dialog() 函数中创建 Jcrop。运行良好,但我无法传递我的 X 和 Y 等值!
函数“updateCoords”有效,但我无法通过它来评估 Ajax!Fire Bug 说我想通过 POST 的变量没有定义,但是“HOW!” - 我在函数 updateCoords() 中定义变量!XD
function open_original(gallery_id, image_name){
$("#image_crop_canves").dialog({
modal:true,
width:634,
height:741,
buttons:{
"SAVE":function(){
$.ajax({
url: "send.php",
type: "POST",
data: "a=crop&x="+cx+"&y="+cy+"&w="+cw+"&h="+ch+"&gid="+gallery_id+"&id="+image_name,
success: function(){
$("#image_crop_canves").dialog('close');
window.location();
}
});
},
"CLOSE":function(){
$("#image_crop_canves").dialog('close');
}
}
});
$("#image_crop").html("<div id=\"image_holder_crop\"><img id=\"cropbox\" src=\"../../pics/gallery/" + gallery_id + "/original/" + image_name + "\" /></div>");
$("#image_crop_canves").dialog('open');
function updateCoords(c) {
var cx = c.x;
var cy = c.y;
var cx2 = c.x2;
var cy2 = c.y2;
var cw = c.w;
var ch = c.h;
}
$('#cropbox').Jcrop({
aspectRatio: 140/360,
onSelect: updateCoords,
setSelect: [0, 0, 140, 360],
minSize: [140, 360]
});
}