how to call a js function from loaded jquery
Posted
by Y.G.J
on Stack Overflow
See other posts from Stack Overflow
or by Y.G.J
Published on 2010-05-28T12:44:55Z
Indexed on
2010/05/28
12:51 UTC
Read the original article
Hit count: 169
the function is in the page loading the ajax but i'm trying to call the function
codes:
[ajax]
$.ajax({
type: "POST",
url: "loginpersonal.asp",
data: "id=<%=request("id")%>",
beforeSend: function() {
$("#personaltab").hide();
},
success: function(msg){
$("#personaltab").empty().append(msg);
},
complete: function() {
$("#personaltab").slideDown();
},
error: function() {
$("#personaltab").append("error").slideDown();
}
});
[the js function]
function GetCount(t){
if(t>0) {
total = t
}
else {
total -=1;
}
amount=total;
if(amount < 0){
startpersonalbid();
}
else{
days=0;hours=0;mins=0;secs=0;out="";
days=Math.floor(amount/86400);//days
amount=amount%86400;
hours=Math.floor(amount/3600);//hours
amount=amount%3600;
mins=Math.floor(amount/60);//minutes
amount=amount%60;
secs=Math.floor(amount);//seconds
if(days != 0){out += days +":";}
if(days != 0 || hours != 0){out += hours +":";}
if(days != 0 || hours != 0 || mins != 0){out += ((mins>=10)?mins:"0"+mins) +":";}
out += ((secs>=10)?secs:"0"+secs) ;
document.getElementById('countbox').innerHTML=out;
setTimeout("GetCount()", 1000);
}
}
window.onload=function(){
GetCount(<%= DateDiff("s", Now,privatesellstartdate&" "&privatesellstarttime ) %>);
so at the end of the loginpersonal.asp from the ajax... if it does what it suppose to do... i'm trying to call the function GetCount() again.
© Stack Overflow or respective owner