Refresh page after action in javascript
I have the following code, that let users crop their pictures. What I try
to do, is to refresh the page after the user croped his picture, to let
him see the thumbnail preview. But I tried to put a refresh code every
single place, and the refresh never work. Any idea on how I can do this?
(Or any idea on what I'm doing wrong?)
<script type="text/javascript">
function getSizes(im, obj) {
var x_axis = obj.x1;
var x2_axis = obj.x2;
var y_axis = obj.y1;
var y2_axis = obj.y2;
var thumb_width = obj.width;
var thumb_height = obj.height;
if (thumb_width > 0) {
$.ajax({
type: "GET",
url: "ajax_image.php?t=ajax&img=" +
$("#image_name").val() + "&w=" + thumb_width + "&h=" +
thumb_height + "&x1=" + x_axis + "&y1=" + y_axis,
cache: false,
success: function (rsponse)
{
$("#cropimage").hide();
$("#thumbs").html("");
$("#thumbs").html("<img src='images/" + response + "'
/>");
}
});
} else
alert("Please select portion..!");
}
$(document).ready(function () {
$('img#photo').imgAreaSelect({
aspectRatio: '1:1',
onSelectEnd: getSizes
});
});
</script>
No comments:
Post a Comment