javascript/ajax to mysql db

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anfetienne
    Contributor
    • Feb 2009
    • 424

    #61
    hi, i have solved this problem myself.....

    the best way to do it is to make your file tht saves data to a DB and then use this java code to load a 2nd page.

    Code:
    <script type="text/javascript">
    <!--
    function dbSubmit(f)
    {
        // submit to action in form
        f.submit();
    
        // set second action and submit
        f.target="_self";
        f.action="data.php";
        f.submit();
        return false;
    }
    //-->
    </script>
    then on your form just add onsubmit="dbSub mit(this)"

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #62
      Line 43 should have been:
      Code:
      httpRequest.send(urlparams);
      i.e. urlparams (the variable) instead of 'urlparams' (the string).

      Comment

      Working...