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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
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) <[EMAIL PROTECTED] >
> wrote:
>>
>>
>>  Urgent!
>> I am new to jQuery.
>> Can anybody help me out why javascript in the loaded contend by AJAX 
>> .post or load can not function at all?
>> How to solve this problem?
>> Any clue or help is appreciated.
>> I am using IE 6.0 browser, and server side is running Catalyst in
Perl.
>>
>> For example.
>> There is one page like:
>> ####################
>> <SCRIPT type="text/javascript" >
>> $(document).ready(function() {
>>     $("input.buttonAdd").click(function(){
>>         $.post('/ajax_input',$("#input_form").fastSerialize(),
>> function(data){
>>         ...
>>         $("div#append_area").append(data);
>>
>>     });
>> });
>> </SCRIPT>
>>
>> ...
>> <FORM id="input_form">
>> <input type="text" name="user" value="" size="12" /> ...
>> <input type="button" value="Add" class="buttonAdd" /> </FORM>
>>
>> <br />
>> <div id="append_area">
>> </div>
>> ##################
>>
>>
>> The remote content 'data' generated by ajax_input in server side 
>> looks
>> like:
>>
>> ########
>> <p>Load by Ajax  </p>
>> <SCRIPT type="text/javascript" >
>> alert("In Ajax loaded content!!!");
>> $(document).ready(function() {
>>     $("a.status").click(function(){
>>         alert("OK>>>>>>>>>");
>>     });
>> });
>> </SCRIPT>
>>
>> <TABLE class="xx">
>> ...
>> <a href="#" class="status">Status</a> ...
>> </TABLE>
>> ########
>>
>>
>> Now the web page is rendered well. When the button 'Add' is clicked,
the
>> remote file is injected into "append_area" div.
>> And my intention is if click hyperlink  "Status', the embeded
javascript
>> codes in the loaded content will be executed.
>>
>> But the problem is the javascript codes such as the alert do not run
at
>> all when the hyperlink  is clicked .
>>
>>
>> Jack
>>
>> _______________________________________________
>> jQuery mailing list
>> [email protected]
>> http://jquery.com/discuss/
>>
>>
>>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>



_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to