以下 JQuery 代码适用于 Chrome 和 Firefox,但不适用于 IE8。我也在手机上试过了,还是不行。我还查看了代码,没有多余的逗号。
在 IE8 中,错误指向...
$(document).on('click', '.arrow -up ' , function () {
<script type="text/javascript">
ajax_url = "<?php
echo admin_url('admin-ajax.php');
?>";
// Make your AJAX request on document ready:
(function ($) {
$(document).on('click', '.del_btn', function () {
var del_id = $(this).attr('rel');
var my_data = {
action: 'deleter_code', // This is required so WordPress knows which function to use
delete_id: del_id
};
$.post(ajax_url, my_data, function (data) {
if (data == 'true') {
$('#' + del_id).remove();
} else {
alert("Could not be deleted");
}
});
});
})(jQuery);
(function ($) {
$(document).on('click', '.arrow-up', function () {
var user_id = $(this).attr('rel');
var my_data = {
action: 'arrow_handler', // This is required so WordPress knows which function to use
move_id: user_id,
dataType: 'JSON',
arrow_status: 'up'
};
$.post(ajax_url, my_data, function (data) {
var objprase=$.parseJSON(data); // now obj is a json object
if (objprase.true == 'true') {
$('#blog-table').replaceWith( objprase.text );
} else {
alert(objprase.true);
}
});
});
})(jQuery);
(function ($) {
$(document).on('click', '.arrow-down', function () {
var user_id = $(this).attr('rel');
var my_data = {
action: 'arrow_handler', // This is required so WordPress knows which function to use
move_id: user_id,
dataType: 'JSON',
arrow_status: 'down'
};
$.post(ajax_url, my_data, function (data) {
var objprase=$.parseJSON(data); // now obj is a json object
if (objprase.true == 'true') {
$('#blog-table').replaceWith( objprase.text );
} else {
alert(objprase.true);
}
});
});
})(jQuery);
</script>