[jQuery] Re: How to enable jquery in a loaded page?

2009-02-06 Thread ilovejquery

It's probably because your jquery code is in $(document).ready()
function and it is never fired when you load with .load().

Put your code in callback function like this:

$(document).ready(function() {
   $(#show).click(function() {
   $(#content).css(overflow-y, scroll);
   $(#content).load(showContent.php, function(){

// your code here...

});
   });


Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com



On Fri, Feb 6, 2009 at 6:40 PM, 123gotoandplay wesweatyous...@gmail.com wrote:

 Hi there,

 I am having a problem to enable jquey in a loaded page.

 For example:

 base.php has jquery and i load showContent.php like:

 $(document).ready(function() {
$(#show).click(function() {
$(#content).css(overflow-y, scroll);
$(#content).load(showContent.php);
});

 but now the jquery in showContent.php doesn't work.

 if i directly browse to showContent.php the jquery does work

 Any tips?


[jQuery] Re: Ajax callback parameter endless

2009-02-06 Thread ilovejquery

Didn't get exactly what you want, but I think you might find useful
the fact that you have arguments array in body of every function()
that has an array of arguments.


Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com



On Fri, Feb 6, 2009 at 7:12 PM, Kpitn pierre.bas...@gmail.com wrote:

 Hi

 I have override the confirm function like this :
 function confirm(msg,callback_true,callback_false) {
 if yes{
 callback_true();
 }
 else{
 callback_false();
 }
 }

 In my application i use the function like this :
 confirm('message',function(){ alert(ok)}, function (){ alert('not
 ok')});

 I must ask the question a lot of time without reload the page.
 The problem is , when i recall the question, the answer is show 2
 times, when i recall another question, the answer is call 3 times,
 etc ...

 I think the problem comes, from the way i use the callback, but how
 can i do if my callbacks functions have parameters ?


 Thx


[jQuery] Re: Ajax callback parameter endless

2009-02-06 Thread ilovejquery

I ran this code:

function confirm(msg,callback_true,callback_false) {
if (1){
  callback_true();
}else{
  callback_false();
}
}


confirm('message',function(){ console.log(ok); }, function(){
console.log('not ok'); });
confirm('message',function(){ console.log(ok); }, function(){
console.log('not ok'); });
confirm('message',function(){ console.log(ok); }, function(){
console.log('not ok'); });

And I'm getting only 3 OK's as it should be. Not 1+2+3 = 6 as you are saying...

Maybe the problem is somewhere else, not in this particular function...


Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com



On Fri, Feb 6, 2009 at 8:59 PM, Kpitn pierre.bas...@gmail.com wrote:

 a call like this : confirm('message ?',function(){showAnswer
 ('1','2','3');})

 the function showAnswer is execute 1 time.

 If i make another call : confirm('message ?',function(){showAnswer
 ('1','2','3');})

 the function showAnswer is execute 2 times.

 I don't want (n+1) answer after call confirm.

 How can i have always one answer ?




 On Feb 6, 3:36 pm, ilovejquery ilovejqu...@gmail.com wrote:
 Didn't get exactly what you want, but I think you might find useful
 the fact that you have arguments array in body of every function()
 that has an array of arguments.

 
 Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com

 On Fri, Feb 6, 2009 at 7:12 PM, Kpitn pierre.bas...@gmail.com wrote:

  Hi

  I have override the confirm function like this :
  function confirm(msg,callback_true,callback_false) {
  if yes{
  callback_true();
  }
  else{
  callback_false();
  }
  }

  In my application i use the function like this :
  confirm('message',function(){ alert(ok)}, function (){ alert('not
  ok')});

  I must ask the question a lot of time without reload the page.
  The problem is , when i recall the question, the answer is show 2
  times, when i recall another question, the answer is call 3 times,
  etc ...

  I think the problem comes, from the way i use the callback, but how
  can i do if my callbacks functions have parameters ?

  Thx