Problem with php inside javascript application in IE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • swethak
    New Member
    • May 2008
    • 118

    Problem with php inside javascript application in IE

    Hi,

    i am getting the problem with php code inside javascript function in Internet Explorer.Here is my javascript and php code.

    Code:
    function addPoints() {
    
                  <?
    		 $query=mysql_query("select * from offices");
    		 while($row=mysql_fetch_array($query)){
    		?>
    		   newpoints[0] = new Array('-33.8673',  '151.2041', icon0, 'testing', 'testing'); 
    		<?
    		}
    		?>
    
    }
    addPoints() is javascript function. It is not working in IE6,IE7 and works fine in Mozilla. When i used in IE i am getting the error as
    " Microsoft Internet Explorer could not open the page .Operation aborted."

    Anybody please tell the solution how can resolve that problem in IE.


    Thanks
    Swethak
    Last edited by Atli; May 24 '09, 09:57 AM. Reason: Moved to the Javascript forum.
  • NitinSawant
    Contributor
    • Oct 2007
    • 271

    #2
    have you declared the newpoints[0] array in javascript?

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      You're setting newpoints[0] each time overwriting the previous ones, though that shouldn't result in the error you're experiencing.

      Comment

      • Ciary
        Recognized Expert New Member
        • Apr 2009
        • 247

        #4
        to fix it you can either do 2 things. first is make an array of newpoints[0]. this means something like this
        Code:
        newpoints[0] = array();
        
        ...
        
        newpoints[0][] = new Array('-33.8673',  '151.2041', icon0, 'testing', 'testing');
        or you just add your new value to newpoints like this:
        Code:
        newpoints[] = new Array('-33.8673',  '151.2041', icon0, 'testing', 'testing');

        Comment

        Working...