CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Ajax and Design (http://www.codingforums.com/forumdisplay.php?f=55)
-   -   AJAX and IE8 Doing my head in please help! (http://www.codingforums.com/showthread.php?t=246135)

enderSFTD 12-12-2011 01:06 PM

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 ????

Arnaud 12-12-2011 01:17 PM

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?

enderSFTD 12-12-2011 01:23 PM

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 ....

Arnaud 12-12-2011 01:41 PM

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...

enderSFTD 12-12-2011 01:48 PM

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?

Arnaud 12-12-2011 02:09 PM

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.


All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.