Thanks, I tried your method and it didn't work out.

I also tried to put all JQuery library and Javascript block in my ajax
page(which is supposed to appear in the s:div). Still doesn't work. 

However, after adding executeScripts="true" in my <s:submit>, if I add
"alert('test');" into my ajax page, I can see it works, which means
Javascript works in my ajax page.

Is it possible this is a JQuery issue?


Sparecreative wrote:
> 
> When using jQuery via ajax you don¹t use jQuery¹s ready function, in you
> case the $(function(){.
> 
> You have two options. The simplest is to set a parameter (eg called
> ajaxRequest) in you action to true, when received via ajax and then change
> your javascript to have a s:if tag and if ajaxRequest is not true then
> include the $(function(){ line.
> 
> For example you javascript block would look like:
> 
>     <script type="text/javascript">
>> <s:if test=²%{!ajaxRequest}>
>>   $(function() {
>> </s:if>
>>         $(".datepicker").datepicker({
>>             changeMonth: true,
>>             changeYear: true,
>>             yearRange: '-5:+5',
>>             showOn: 'button', buttonImageOnly: true, buttonImage:
>> 'images/calendar.gif'
>>         });
>> <s:if test=²%{!ajaxRequest}>
>>     });
>> </s:if>
>>     </script>
> 
> 
> The option is to have either separate jsp pages or separate javascript
> blocks.
> 
> 

-- 
View this message in context: 
http://old.nabble.com/JQuery-UI-datepicker-doesn%27t-work-in-a-struts-2-ajax-page-tp26230811p26268920.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to