php - Internal 500 error on ajax post -
i trying post on our ajax request update user meta (this not wordpress related question). way is, use jquery draggable ui .position retrieve position.top number, @ stop() called function posts value ajax file. reason returns 500 internal error , makes our ajax file inactive other functions.
this first step $(document).ready(function() {
$(".top_image_roll").hide(); $(".five img").draggable({ axis: "y", // find original position of dragged image. start: function(event, ui) { // show start dragged position of image. var startpos = $(this).position(); }, // find position image dropped. stop: function(event, ui) { // show dropped position. var stoppos = $(this).position(); update_image_coords_1(stoppos.top); } }); }); </script> <?php } else { ?> <?php }?> this function
function update_image_coords_1(coordss) { $.post('http://xxx/xxx/xxx/xxx/ajax.php', { 'action': 'update_image_coords_1', 'coords': coordss, 'user_id': '<?php echo $user_id; ?>' } ); } and on ajax file
if( !empty($_request['action']) && $_request['action'] == 'update_image_coords_1' && !empty($_request['user_id']) && !empty($_request['coords'])) { $coords = $_request['coords']; update_user_meta($_request['user_id'], 'update_image_coords_1', $coords); die(); } is there doing wrong? other suggestions? in advance
your if statement missing couple of closing brackets after empty calls:
if( !empty( $_request['action']) && $_request['action'] == 'update_image_coords_1' && !empty($_request['user_id'] && !empty($_request['coords']) { should be:
if( !empty( $_request['action']) && $_request['action'] == 'update_image_coords_1' && !empty($_request['user_id']) && !empty($_request['coords'])) {
Comments
Post a Comment