altariamx2003
asked on
how to avoid redundand ajax calls
Hi guys
Im working in a new project where i push a button where using this ajax code:
I produce this html links
and when I do a click under any of that links I use this following code to perform actions for the page:
When I do click on any of the dynamic links for the first time evryting works great, but no matter what i try when i do click for second time the page calll 2 times the following ajax code:
Im working in a new project where i push a button where using this ajax code:
function loadData(del_name)
$("#cont_part1").html('');
$.ajax
({type: "POST", url: "olga-json.php", data: { rID:'<?php echo $_SESSION['MM_rID']; ?>', estado: del_name, fluido:document.getElementById("fluido").value, temp_min:document.getElementById("temp_min").value, temp_max:document.getElementById("temp_max").value, temp_num:document.getElementById("temp_num").value, pres_min:document.getElementById("pres_min").value, pres_max:document.getElementById("pres_max").value, pres_num:document.getElementById("pres_num").value },
success: function(msg)
{
$(document).ajaxComplete
(
function(event, request, settings)
{ $("#cont_part").html(msg); $("#cont_part1").html(''); losresultados = ""; });
}
});
}
I produce this html links
<a href="javascript:void(0);" class="latemp">10</a>
<a href="javascript:void(0);" class="latemp">18</a>
and when I do a click under any of that links I use this following code to perform actions for the page:
$(".latemp").on("click", function(e)
//$(".latemp").click(function(e)
//$( document ).on( 'click', '.latemp', function(e)
{
});
When I do click on any of the dynamic links for the first time evryting works great, but no matter what i try when i do click for second time the page calll 2 times the following ajax code:
$.ajax
(
{
type: "POST", url: "propnoexiste-json.php",
data: { rID:'<?php echo $_SESSION['MM_rID']; ?>', fluido:temp2[1], temp:eltexto, pres_min:document.getElementById("pres_min").value, pres_max:document.getElementById("pres_max").value, pres_num:document.getElementById("pres_num").value },
success: function(msg)
{
$(document).ajaxComplete
(
function(event, request, settings)
{
var elmsg = msg.split("SEPARA");
if(losresultados != "")
{ losresultados = losresultados+"SEPARAR"+'temp'+eltexto+"|"+elmsg[1]; }
else
{ losresultados = 'temp'+eltexto+"|"+elmsg[1]; }
$("#cont_part1").html(elmsg[0]);
}
);
}
}
);
what I missing?? what im doing wrong???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That's a separate issue.
Check your console (F12) to see what is being returned from the server.
Show us what that data looks like raw - the more info you give us the easier it will be to assist you.
Check your console (F12) to see what is being returned from the server.
Show us what that data looks like raw - the more info you give us the easier it will be to assist you.
ASKER
works now bro
thx a lot for help
thx a lot for help
You are most welcome.
ASKER
Open in new window
do not show any content