I have a code and the code works fine but I have a sucess function on a click button (guardar) and the sucess function works fine too but (and this is the really weird part) I have a code into that sucess function that only works if I have and undefinide work inside.
So, this is the code the bold part is the part of the problem (by the way Im newbie so maybe my code is no the best way to do it): the bold part
doesn´t execute without the undefinide word.
$("#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();
//funcion para cambiar
});
//incioexpe
$(".guardar").live('click',function()
//.live('change',function(e)
{
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+'&discount2='+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)
{
$("#four_"+ID).html(four_val);
$("#four_"+ID).show();
undefinideword
}
});
}
else
{
alert('Ingresa algo');
}
});
//finexpe
// Edit input box click action
$(".editbox").live("mouseup",function(e2)
{
e2.stopImmediatePropagation();
});
// Outside click action
$(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;
}
});
});