[jQuery] [Beginner. Help] Javascript not function in the loaded content by AJAX
thanks, all :)
now, I apply
eval($("div#append_area script").html());
after:
$("div#append_area").append(data);
it works.
I have thought to use:
$("div#append_area").
load('/ajax_input',$("#input_form").fastSerialize(), function(data)
// do stuff on laod
});
But the loaded content by ajax seems like restricted to div#append_area,
so I used .post() method.
-----Original Message-----
From: discuss-bounces@jquery.com [mailto:discuss-bounces@jquery.com] On
Behalf Of jyl@mod3.net
Sent: Friday, November 17, 2006 11:35 AM
To: jQuery Discussion.
Subject: Re: [jQuery] [Beginner. Help] Javascript not function in the
loaded content by AJAX
Actually AFAIK .ajax and .load both evaluate returned scripts.. And
there's also jxs (http://www.brainknot.com/code/jxs.htm) which allows
you to do a whole lot more :)
--Jacob
> Only $().load evaluates loaded scripts, so the easy solution to this
> is to do this instead:
> $("div#append_area").load('/ajax_input',$("#input_form").fastSerialize
> (),
> function(data)
> // do stuff on laod
> });
>
> You can also try adding the data to the page then:
> eval($("div#append_area script").text());
>
> Blair
>
> On 11/17/06, Liu, Xiao-Guang (OSLO-R&D-China) <xiaoguang.liu@hp.com >
>