Ajax with jQuery UI dialog not working
-
I am trying to update my custom database table when changes are made in a dialog box. The script for the dialog box and ajax call is as follows –
jQuery(document).ready(function($){ $("td > span").click(function(){ var id = $(this).attr('id'); var message = "message"+id; var content = jQuery("#"+message).text(); var $dialog = $("<div></div>").html("<textarea style='width:99%; height:90%' class='popup-content'>"+content+"</textarea>").dialog({ height: 400, width: 400, title: 'My Data', modal: true, autoOpen: false, dialogClass: 'wp-dialog', buttons: { "Save": function(){ $("#"+message).html($(".popup-content").val()); $.ajax({ type: "post", url: "admin-ajax.php", data: { action: "feedmng_update", feed_id: id } }); } } }); $dialog.dialog("open"); }); });
The above script works all well but for the Ajax part. The above code is a separate javascript file which I even enqueue in my php file. The following is the Ajax call related code to update database having the id passed during the Ajax call –
function __construct(){ add_action( 'wp_ajax_feedmng_update', array( &$this, 'feedmng_update' ) ); } function feedmng_update(){ global $wpdb; $feedid = $_REQUEST["feed_id"]; $wpdb->update( $wpdn->feedmanager, array( 'message' => "New data" ), array( 'id',$feedid ) ); }
My table name is wp_feedmanager and I am trying to update it’s ‘message’ column. But it just wont update ? Any suggestions what should be done ?
- The topic ‘Ajax with jQuery UI dialog not working’ is closed to new replies.