So I\'m working on a WordPress website. I\'m having a bit of a difficult time getting the user input to update the database.
JS:
var ID = $(this).at
Here is the issue, for ajax requests we use http://example.com/wp-admin/admin-ajax.php
.
Also your data string should cantain &action=editItems
( same as you use in wp_ajax_editItems
)
You ajax request code should look like...
$.ajax({
type: "POST",
url: "/wp-admin/admin-ajax.php",
data: dataString + '&action=editItems',
cache: false,
error: function(xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(err.Message);
},
success: function (html) {
$("#name_"+ID).html(name);
$("#createDate_"+ID).html(createDate);
$("#stats_"+ID).html(stats);
$("#dateExpire_"+ID).html(dateExpire);
}
});
For more details check out https://codex.wordpress.org/AJAX_in_Plugins
Hope that helps :)