Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Civil_777

    (@civil_777)

    Nice! It worked. I created a global javascript variable in my child theme functions.php file as follows:

    function civil_addto_header() { ?>
    <script>testpost_url = '<?php echo bloginfo('stylesheet_directory') . '/testpost.php'; ?>';</script>
    <?php }
    
    add_action('wp_head', 'civil_addto_header');

    Thanks!

    Thread Starter Civil_777

    (@civil_777)

    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>

    Thread Starter Civil_777

    (@civil_777)

    Great, thanks!

    Not sure I understand the Steve Jobs comment…

    Thread Starter Civil_777

    (@civil_777)

    Thanks, that is what I need. I have a few more questions about how to use wp_enqueue_script. I will post those questions separately.

Viewing 4 replies - 1 through 4 (of 4 total)