gpt4 book ai didi

javascript - jquery "stopImmediatePropagation is not a function"错误

转载 作者:行者123 更新时间:2023-11-30 13:06:42 25 4
gpt4 key购买 nike

我得到这个代码 http://www.technoread.net/webdesign/javascript-a-jquery/item/89-live-table-edit-delete-with-pagination-using-jquery并修改为:

代码运行良好,但 firebug 在这部分显示错误:

$("#four_"+ID).html(four_val);
$("#five_"+ID).html(five_val);


e.stopImmediatePropagation();

}
});
}

enter image description here

  $("#edit_td").focus(function(){
$(this).width(1500)
});

$(document).ready(function()
{
$(".delete").live('click',function()
{
var id = $(this).attr('id');
var b=$(this).parent().parent();
var dataString = 'id='+ id;
if(confirm("Estás seguro de que quieres borrar este proceso? se borrará completamente"))
{
$.ajax({
type: "POST",
url: "delete_ajax.php",
data: dataString,
cache: false,
success: function(e)
{
$(".tablasuperior").hide();
$(".tablainferior").hide();
$("#avisoborrado").show();
e.stopImmediatePropagation();
}
});
return false;
}
});



//editar click en la tr


$(".bote").live('click',function()
//$(".edit_tr").live('dblclick',function()
{
var ID=$(this).attr('id');


$("#four_"+ID).hide();
$("#five_"+ID).hide();



$("#four_input_"+ID).show();
$("#five_input_"+ID).show();


})




$(".guardar").live('click',function()

{
var ID=$(this).attr('id');

var one_val=$("#one_input_"+ID).val();
var two_val=$("#two_input_"+ID).val();
var three_val=$("#three_input_"+ID).val();
var four_val=$("#four_input_"+ID).val();
var five_val=$("#five_input_"+ID).val();

var dataString = 'id='+ ID +'&name='+one_val+'&category='+two_val+'&price='+three_val+'&discount='+four_val+'&discount 2='+five_val;;
if(one_val.length>0&& two_val.length>0 && three_val.length>0 && four_val.length>0)
{

$.ajax({
type: "POST",
url: "live_edit_ajax.php",
data: dataString,
cache: false,
success: function(e)
{

$("#one_"+ID).html(one_val);
$("#two_"+ID).html(two_val);
$("#three_"+ID).html(three_val);
$("#four_"+ID).html(four_val);
$("#five_"+ID).html(five_val);


e.stopImmediatePropagation();

}
});
}
else
{
alert('Ingresa algo');
}

});



$(".editbox").live("mouseup",function(e)
{
e.stopImmediatePropagation();
});


$(document).mouseup(function()
{
//si hay clic en el layout esconde la edit box y muestra la de texto
$(".editbox").hide();
$(".text").show();
});


//Pagination

function loading_show(){
$('#loading').html("<img src='images/loading.gif'/>").fadeIn('fast');
}
function loading_hide(){
$('#loading').fadeOut('fast');
$("#avisoborrado").hide();
}
function loadData(page){
loading_show();
$.ajax
({
type: "POST",
url: "load_data.php",
data: "page="+page,
success: function(msg)
{
$("#container").ajaxComplete(function(event, request, settings)
{
loading_hide();
$("#container").html(msg);
});
}
});
}
loadData(1); // For first time page load default results
$('#container .pagination li.active').live('click',function(){
var page = $(this).attr('p');
loadData(page);
});
$('#go_btn').live('click',function(){
var page = parseInt($('.goto').val());
var no_of_pages = parseInt($('.total').attr('a'));
if(page != 0 && page <= no_of_pages){
loadData(page);
}else{
alert('Ingrese un proceso entre 1 y '+no_of_pages);
$('.goto').val("").focus();
return false;
}
});

});

最佳答案

jquery ajax 函数的success 回调没有事件作为参数。它不是 DOM 事件,并且是异步执行的。

更新:

$(".guardar").live('click',function(e) {

< your code here >

if(one_val.length>0&& two_val.length>0 && three_val.length>0 && four_val.length>0)
{
e.stopImmediatePropagation();
$.ajax({
type: "POST",
url: "live_edit_ajax.php",
data: dataString,
cache: false,
success: function(data) {
$("#one_"+ID).html(one_val);
$("#two_"+ID).html(two_val);
$("#three_"+ID).html(three_val);
$("#four_"+ID).html(four_val);
$("#five_"+ID).html(five_val);
}
});
}
else
{
alert('Ingresa algo');
}
});

关于javascript - jquery "stopImmediatePropagation is not a function"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15423948/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com