SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2008
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I don't know about the IE error, but that code can't be what you want. It overwrites newpoints[0] as many times as there are rows from that query (I think you meant to create new entries in the array?), and none of the variables in the array depend on the row's data.

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should start by hardcoding the valid javascript portion. Then, once you get that working, you can think about dynamically producing the javascript with php.

  4. #4
    SitePoint Evangelist priti's Avatar
    Join Date
    Aug 2006
    Location
    India
    Posts
    488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    newpoints[0] = new Array('-33.8673', '151.2041', icon0, 'testing', 'testing');

    May this modification can help

    newpoints[i] = new Array('-33.8673', '151.2041', icon0, 'testing', 'testing');
    i=i+1;


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •