SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Aug 2010
    Posts
    503
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jQuery Kind of Working :/

    Hi all, I have a slight problem with my AJAX, it's kind of working in that it seems to be connection to my PHP file and updating but the problem seems to be in the return of the data as I just get the alert PROBLEM. If I refresh the page the new content is in place. It's just not coming out through AJAX for some reason :/ Any help would be appreciated

    Code JavaScript:
    <script>
     
        function ajaxUpdate(help){
     
            if(help !==""){
                jQuery.ajax({
                   type: "POST",
                   dataType: "json",
                   url: "/includes/ajax_basket_updates.php",
                   data: help,
                   success: function(data){
                       jQuery('#basketTable').html(data.cart);
                   },
                   error: function(){
                       alert('PROBLEM!');
                   }
                });
            }
     
        }
     
        jQuery(document).ready(function() {
            //If user updates hire period...
            jQuery('#pricingSelect').change(function(){
                var selected = jQuery('#pricingSelect option:selected').val();
                ajaxUpdate('period='+selected);
            });
        });
    </script>

  2. #2
    SitePoint Zealot Gar onn's Avatar
    Join Date
    Feb 2011
    Location
    Belgium
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I suggest you look at your develooppers tools (or firebug,....) network tab to see what the PHP returns.

    and check the value of "help"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •