Web Analytics Made Easy -
StatCounter Calling php script from javascript - CodingForum

Announcement

Collapse
No announcement yet.

Calling php script from javascript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling php script from javascript

    I have form data submitted via AJAX; I'd like to display the information on the same page as the form once the data is inserted into the target table. I thought of using javascript to check if the insert was successful and then display the content via:

    Code:
    document.getElementById("displayData").innerHTML = 'echo "formData->display();"';
    The display() method retrieves the inserted data and displays it.

    Does my idea/code make sense? Suggestions and feedback are appreciated. Thanks.

  • #2
    Javascript is client side and PHP is server side....

    you have to make like a call to another page and that page is for tracking and variables on that page is passed by $_GET[''].....

    Go find how you can call a webpage from javascript and you can call a page like:

    check.php?FORM_FIELD=VALUE&FORM_FIELD=VALUE

    Hope that helps!

    Comment

    Working...
    X