Forum Replies Created

Viewing 15 replies - 301 through 315 (of 574 total)
  • Thread Starter Bloke

    (@bloke)

    Ok this is what I have so far. It will enter each record but it will not enter the prod_order for each line.

    $getem = $wpdb->get_row("SELECT * FROM category_assoc WHERE prod_id = '$lastID'");
    
    $prodorder = $getem->prod_order;
    
    if($edit)
    
    for($i= 0; $i < count($cats); $i++)
    
        {
    
    $catCategory = "INSERT INTO category_assoc (prod_id, cat_id, prod_order) VALUES('$lastID', '". $cats[$i] . "', '".$prodorder."')";
    
    $wpdb->query($catCategory);
        }

    Forum: Fixing WordPress
    In reply to: Enable compression
    Thread Starter Bloke

    (@bloke)

    Yes I am assuming its not installed. After reading some more, it should be listed as an available module to install. I know my server is really outdated. Since its a dedicated server I will have to search on help forum at the hosting company.

    Thread Starter Bloke

    (@bloke)

    Finally got it working. At least this part of my project. The missing part was the “action”. It was posting the ID but didn’t know where to send it. Then I saw this simple-ajax-example tutorial sending a variable via Ajax and then printing it. I compared what was being done. Viewed the result in Firebug. Then inside a PHP function “example_ajax_request” I retrieved the ID and ran the query inside this function. All I needed was a simple example to figure how it works.

    $("select#category").change(function(){
                  $("select#type").attr("disabled","disabled");
                      $("select#type").html("<option>wait...</option>");
    
                       jQuery.ajax({
                       type: 'POST',
                       url: ajaxurl,
                       data: {action:"example_ajax_request",id: $(this).val() },
                        success:function(data){
                                   $("select#type").removeAttr("disabled");
                                   $("select#type").html(data);
    
                        }
                    });
            });
      });

    Thread Starter Bloke

    (@bloke)

    Got this part to work. It sends the post with the ID but I can’t receive it and process it.

    <script type="text/javascript">
    jQuery(document).ready(function()     {
            $("select#category").change(function(){
                  $("select#type").attr("disabled","disabled");
                      $("select#type").html("<option>wait...</option>");
                       jQuery.ajax({
                        type: 'POST',
                        url: ajaxurl,
                        data: {id: $(this).val() },
                        success:function(data){
                               $("select#type").removeAttr("disabled").html(data);
                        }
                    });
            });
      });
    
    </script>

    Forum: Fixing WordPress
    In reply to: How to add ajaxurl
    Thread Starter Bloke

    (@bloke)

    It worked! Thanks. But what should show in ‘display’?

    function view_site_description(){
        echo get_bloginfo( 'description', 'display' );
        die();
    }function view_site_description(){
        echo get_bloginfo( 'description', 'display' );
        die();
    }

    Forum: Fixing WordPress
    In reply to: How to add ajaxurl
    Thread Starter Bloke

    (@bloke)

    That is what I was thinking. In the exmaple they didn’t use that. How would that look?

    Forum: Fixing WordPress
    In reply to: How to add ajaxurl
    Thread Starter Bloke

    (@bloke)

    Looking above is is included correctly? I am loading them in my theme’s functions file.

    Forum: Fixing WordPress
    In reply to: How to add ajaxurl
    Thread Starter Bloke

    (@bloke)

    No its only local version. This is what I am doing. Only 3 functions. /wp/wp_ajax

    Forum: Fixing WordPress
    In reply to: How to add ajaxurl
    Thread Starter Bloke

    (@bloke)

    jQuery('#view_site_description').click(function(){
    Nothing happens. Looking in Firebug I don’t see any events triggered.

    Forum: Fixing WordPress
    In reply to: How to add ajaxurl
    Thread Starter Bloke

    (@bloke)

    function add_ajaxurl_cdata_to_front(){ ?>
        <script type="text/javascript"> //<![CDATA[
            ajaxurl = '<?php echo admin_url( 'admin-ajax.php'); ?>';
        //]]> </script>
    <?php }
    add_action( 'wp_head', 'add_ajaxurl_cdata_to_front', 1);
    
    add_action( 'wp_footer', 'add_js_to_wp_footer' );
    function add_js_to_wp_footer(){ ?>
        <script type="text/javascript">
        jQuery('#view_site_description').click(function(){
            jQuery.ajax({
                type: 'POST',
                url: ajaxurl,
                data: {"action": "view_site_description"},
                success: function(data){alert(data);}
            });
            return false;
        });
        </script>
    <?php }
    
    function view_site_description(){
        echo get_bloginfo( 'description', 'display' );
        die();
    }
    add_action( 'wp_ajax_view_site_description', 'view_site_description' );
    add_action( 'wp_ajax_nopriv_view_site_description', 'view_site_description' );
    Thread Starter Bloke

    (@bloke)

    I think it is because I was not using admin-ajax URL. I am working on adding that to get it to work.

    Thread Starter Bloke

    (@bloke)

    I looked at some of my other scripts on my WordPress sites and saw they used jQuery(‘select…… instead of $(“select……
    So I changed all the instances of $ and still not working.

    Thread Starter Bloke

    (@bloke)

    I was able to put ‘tag’ => ‘tag name here’,
    and it displayed just the products with that tag but is there a way to accomplish like above without using tags?

    Thread Starter Bloke

    (@bloke)

    Well I am stumped. I cannot get it to retrieve that ID. Its only 3 files. If anyone can copy and paste this code in WordPress and get it to work let me know. how-to-create-chained-select-with-php-and-jquery/

    Thread Starter Bloke

    (@bloke)

    I changed the function ShowType()to included

    $id = $_POST[id];

    But still its not receiving the ID. Getting this warning: Notice: Undefined index: id

Viewing 15 replies - 301 through 315 (of 574 total)