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-12-2011, 01:06 PM   PM User | #1
enderSFTD
New to the CF scene

 
Join Date: Dec 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
enderSFTD is an unknown quantity at this point
AJAX and IE8 Doing my head in please help!

Hi Guys and Girls,

i am currently working on a project and have noticed that in ie8 when loading a php file using AJAX / JQuery.load() it will not load if the php contains and <script> tags!!!

Only IE8 ????

If i remove the scripts from within the php file it works??

Any suggestions below is the code I'm using to load the php file

Code:
var parts = window.location.href.split('?', 2);

// After calling split(), 'parts' is an array with two elements:
// parts[0] is 'sometext'
// parts[1] is '20202'

var the_text = parts[0];
var the_num  = parts[1];

$(document).ready(function() {
 	 $("#dealsystem").load('assets/snippets/bogof/dealsystem.inc.php?'+the_num);
   var refreshId = setInterval(function() {
      $("#dealsystem").load('assets/snippets/bogof/dealsystem.inc.php?'+the_num);
   }, 10000);
   $.ajaxSetup({ cache: false });
});
Thanks in advance and sorry for excessive ????
enderSFTD is offline   Reply With Quote
Old 12-12-2011, 01:17 PM   PM User | #2
Arnaud
Regular Coder

 
Join Date: Jan 2008
Location: Geneva, Switzerland
Posts: 413
Thanks: 12
Thanked 29 Times in 29 Posts
Arnaud is on a distinguished road
Why would you need to have <scripts> in your php page? Can't you find a way to have those scripts in your js page and have only PHP in your php pages?
__________________
Chuck Norris counted to infinity.
Twice.
Arnaud is offline   Reply With Quote
Old 12-12-2011, 01:23 PM   PM User | #3
enderSFTD
New to the CF scene

 
Join Date: Dec 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
enderSFTD is an unknown quantity at this point
I am using the php to pull events from mysql and to then output the names followed by a count down timer for which the variables are being generated within the while loop. Code below:

Code:
echo '<script type="text/javascript">';

	$result2 = mysql_query("SELECT * FROM deal_detail, deal_times, vendor_details WHERE deal_detail.id = deal_times.deal_id AND deal_detail.vendor_id = vendor_details.id AND category_id = '$category' AND detail_approved = 1 AND payment_approved = 1 AND final_approval = 1  AND $phpdate = 1 AND start_date < now() AND end_date > now() AND $daystart < now() AND $dayend > now() GROUP BY deal_times.deal_id  ORDER BY $dayend $dir");

	while($row2 = mysql_fetch_array($result2))
	  {
		
		$phpdate2 = strtotime( $row2[$phpdate.'_end'] );
	
		
		$mysqldate = date( 'F d, Y H:i:s', $phpdate2 );
		
		echo'		

					var futuredate'.$timeid2.'=new cdtime("countdowncontainer'.$timeid2.'", "'.$mysqldate.'")
					futuredate'.$timeid2.'.displaycountdown("days", formatresults)

				
					';
					 $timeid2 = $timeid2+1;
		}
	
	echo '	</script>';
It works in every other browser just not in IE8 and the crazy bit is if i remove the <script> tag it outputs the results just not the timer. Add the script tag back in and BOOM no output ....

Even crazier than that is i have a similar system on another page which has no issues ....
enderSFTD is offline   Reply With Quote
Old 12-12-2011, 01:41 PM   PM User | #4
Arnaud
Regular Coder

 
Join Date: Jan 2008
Location: Geneva, Switzerland
Posts: 413
Thanks: 12
Thanked 29 Times in 29 Posts
Arnaud is on a distinguished road
Well, I can't say what causes issues with IE8 (and cannot test under IE right now) but...

I wouldn't do it that way anyway.

What I would do is: Have the JS to do an AJAX call to the PHP page, and have PHP to return all you need to construct your timer - but - I would construct the timer on the JS side and not on the PHP side.

Hope this makes sense...
__________________
Chuck Norris counted to infinity.
Twice.
Arnaud is offline   Reply With Quote
Old 12-12-2011, 01:48 PM   PM User | #5
enderSFTD
New to the CF scene

 
Join Date: Dec 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
enderSFTD is an unknown quantity at this point
I guess my question is why if i include the php directly on the page does it work but loading it through AJAX it doesn't?
enderSFTD is offline   Reply With Quote
Old 12-12-2011, 02:09 PM   PM User | #6
Arnaud
Regular Coder

 
Join Date: Jan 2008
Location: Geneva, Switzerland
Posts: 413
Thanks: 12
Thanked 29 Times in 29 Posts
Arnaud is on a distinguished road
Yes, I understand your question and I am sorry but I can't tell. Still I think the way you are doing it is not "best-practice" but I can't really tell you why it doesn't work.
__________________
Chuck Norris counted to infinity.
Twice.
Arnaud 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 04:37 AM.


Advertisement
Log in to turn off these ads.