Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-13-2010, 07:54 PM   PM User | #1
tjfoz
New Coder

 
Join Date: Nov 2010
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
tjfoz is an unknown quantity at this point
AJAX and JS date input

Hello All,

I am using a JS date input script (http://www.dynamicdrive.com/dynamici...oncalendar.htm) that I have been using successfully for years. This is the first time I have tried to place it into an AJAX loaded page and it does not display. The code snippet below is loaded into the page via AJAX, as I said, and I can see the code on the Firebug console. The js is included in the main page and again in the AJAX page that loads the main page (just for good measure). Any ideas on why my input isn't showing up? Thanks for any help!

PHP Code:
    $dateVar "inputDate" $i;
    if (empty(
$inputDate[$i]))
      
$inputDate[$i] = date("m/d/Y");
    
$body .= "<td align=center><script>DateInput('" $dateVar "', 'true', 'MM/DD/YYYY', '" $inputDate[$i] . "')</script></td>\n"
P.S. I have tried other date input scripts as well to no avail.
tjfoz is offline   Reply With Quote
Old 12-13-2010, 08:39 PM   PM User | #2
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,461
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
scipt tags don't fire when ajax'd in.
use a regexp to find the tags and eval the content.
examples abound, and many libraries do it automatically.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Old 12-13-2010, 09:55 PM   PM User | #3
tjfoz
New Coder

 
Join Date: Nov 2010
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
tjfoz is an unknown quantity at this point
Thanks for the response rnd me. What you are saying makes sense. I'm an experienced php coder but not so experienced with js. Could you point me to a specific example? I did a web search but the pieces are just not coming together for me.
tjfoz is offline   Reply With Quote
Old 12-13-2010, 10:30 PM   PM User | #4
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,461
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
if newHTML was the text you are injecting,
Code:
eval((newHTML.match(/<script[^>]*>([\s\S]*?)<\/script>/gmi)||[]).join("\n"));
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Old 12-14-2010, 03:59 PM   PM User | #5
tjfoz
New Coder

 
Join Date: Nov 2010
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
tjfoz is an unknown quantity at this point
Where would I place that line of code? Sorry for being a complete blockhead, but I can't seem to figure it out.

After the HTML is loaded into the <div> tag (in the php page)? As part of the AJAX call before the .send?

Thanks!
tjfoz is offline   Reply With Quote
Old 12-15-2010, 04:53 AM   PM User | #6
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,461
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
hard to say, post the generated html and i'll take a look.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:02 AM.


Advertisement
Log in to turn off these ads.