Forums

jQuery post call is not working at all (3 posts)

  1. Civil_777
    Member
    Posted 7 months ago #

    I have a jQuery script that I am using to 1) create a modal dialog, 2) verify the data, 3) submit the data to a php script (which goes on to update the database). Everything works except for step 3) -- the call to jQuery.post(). Nothing is returned from the php file that is called by post -- not even a simple echo. I have commented the code below showing what is not working.

    [Code removed. Please post to Pastebin.com - Moderator]

  2. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 7 months ago #

    That code was too long for the forums. Please post it up on pastebin.com and link back.

  3. Civil_777
    Member
    Posted 7 months ago #

    No problem. I will post the relevant pieces of code.

    Javascript that is not working (in the file contact_form.js, which is included in my page through wp_enqueue_script()):

    jQuery.post( "contact_form_submit.php", postdata,
      function(data){
        alert(data);
      });

    I am expecting a simple alert with the data in it. Instead, I get nothing.

    Contents of contact_form_submit.php:

    echo "Your form has been submitted.";

    Includes in the html header of the page in question:

    <script type='text/javascript' src='http://mydomain/wp-includes/js/l10n.js?ver=20101110'></script>
    
    <script type='text/javascript' src='http://mydomain/wp-includes/js/jquery/jquery.js?ver=1.6.1'></script>
    <script type='text/javascript' src='http://mydomain/wp-content/themes/mytheme/js/randombg.jquery.js?ver=0.1'></script>
    <script type='text/javascript' src='http://mydomain/wp-content/themes/mytheme/js/DOMAssistantCompressed.js?ver=3.2.1'></script>
    <script type='text/javascript' src='http://mydomain/wp-content/themes/mytheme/js/ie-css3.js?ver=3.2.1'></script>
    <script type='text/javascript' src='http://mydomain/wp-content/themes/mytheme/js/PreloadCssImages.jQuery_v5.js?ver=5'></script>
    <script type='text/javascript' src='http://www.google.com/jsapi?ver=3.2.1'></script>
    <script type='text/javascript' src='http://mydomain/wp-content/themes/mytheme/js/search_input.js?ver=3.2.1'></script>
    <script type='text/javascript' src='http://mydomain/wp-content/themes/mytheme/js/tableH.js?ver=3.2.1'></script>
    <script type='text/javascript' src='http://mydomain/wp-content/themes/mytheme/js/custom.js?ver=1'></script>
    
    <script type='text/javascript' src='http://mydomain/wp-content/themes/mytheme/js/hoverbox.js?ver=3.2.1'></script>
    <script type='text/javascript' src='http://mydomain/wp-content/themes/mytheme/js/contact_form.js?ver=3.2.1'></script>

Reply

You must log in to post.

About this Topic