Results 1 to 2 of 2
  1. #1
    zeberrun is offline Member
    Join Date
    Sep 2011
    Posts
    1
    Rep Power
    0

    Default getobject error retrieving mysql option

    hello,

    i have java script below. i am retrieving states from mysql database and list them dropdown menu.
    oscommerce, mysql and php.

    this script works well when it is embedded between head tags to each php file in old version. goes to city_get.php and takes the state result from there. but in the new version (no head tags in php file) i saved the script as js file and try to call from template_top.php (which shows the all the java's way), explorer gives error in the below line. i have followed this error from explorer error messages.

    getObject("states").innerHTML = req.responseText;

    what is wrong with this?
    thx

    <?php
    /*
    $Id$
    osCommerce, Open Source E-Commerce Solutions
    http://www.oscommerce.com
    Copyright 2003 osCommerce
    Released under the GNU General Public License
    */
    ?>
    <script type="text/javascript"><!--
    var req;
    function loadXMLDoc(key) {
    var url="city_get.php?ShptsiD=<?php echo tep_session_id();?>&country="+key;
    getObject("states").innerHTML = ' <img style="vertical-align:middle" src="images/loading.gif"> Pls hold...';
    try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
    catch(e) {
    try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
    catch(oc) { req = null; }
    }
    if (!req && typeof XMLHttpRequest != "undefined") { req = new XMLHttpRequest(); }
    if (req != null) {
    req.onreadystatechange = processChange;
    req.open("GET", url, true);
    req.send(null);
    }
    }
    function processChange() {
    if (req.readyState == 4 && req.status == 200) {
    getObject("states").innerHTML = req.responseText;
    }
    }
    function getObject(name) {
    var ns4 = (document.layers) ? true : false;
    var w3c = (document.getElementById) ? true : false;
    var ie4 = (document.all) ? true : false;
    if (ns4) return eval('document.' + name);
    if (w3c) return document.getElementById(name);
    if (ie4) return eval('document.all.' + name);
    return false;
    }

    //--></script>

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,247
    Rep Power
    19

    Default Re: getobject error retrieving mysql option

    This is a Java forum. Not a PHP forum, not a JavaScript forum.

    Locking this off topic thread.

    db

Similar Threads

  1. error with connection Mysql
    By ahmadn in forum Java Applets
    Replies: 5
    Last Post: 06-17-2011, 10:54 AM
  2. Replies: 1
    Last Post: 04-05-2011, 08:28 AM
  3. Error while connecting to mysql server
    By Anandt88 in forum JDBC
    Replies: 1
    Last Post: 08-16-2010, 02:37 PM
  4. error while retrieving data from data base
    By kirtesh4u in forum New To Java
    Replies: 5
    Last Post: 11-15-2008, 04:10 PM
  5. resultSet jdbc getObject( ? )
    By Peter in forum JDBC
    Replies: 2
    Last Post: 07-04-2007, 06:40 AM

Posting Permissions

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