SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Executing jQuery function on Javascript Ajax Success

    I have a setup where when the user changes the item on the dropdown, the price is updated by ajax.

    I want the price to pulsate with jquery ui after the price is updated.

    How can I do this? Here's my javascript:

    Code:
    <script type="text/javascript">
    function getxmlHttpObj()
    {
    		var xmlHttp;
    		try
    		{
    			// Firefox, Opera 8.0+, Safari
    			xmlHttp=new XMLHttpRequest();
    		}
    		catch (e)
    		{
    			// Internet Explorer
    			try
    			{
    				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    			}
    			catch (e)
    			{
    				try
    				{
    					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    				}
    				catch (e)
    				{
    					alert("Your browser does not support AJAX!");
    					return false;
    				}
    			}
    		}
    		return xmlHttp;
    }
    
    function getPrice(price,product_id,attr_arr)
    {
    		opt_id = document.getElementById("optionsid").value;
    
    		xmlHttpObj = getxmlHttpObj();
    
    		xmlHttpObj.onreadystatechange=function()
    		{
    			if(xmlHttpObj.readyState==4)
    			{
    				document.getElementById("display_price").innerHTML =  xmlHttpObj.responseText;
    			}
    		}
    		xmlHttpObj.open("GET","ajax_onchange_price.php?price="+price+"&option_id="+opt_id+"&product_id="+product_id+"&product_opt="+attr_arr,true);
    		xmlHttpObj.send();
    
    }
    </script>
    Thanks.

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bump

  3. #3
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    Where it says:
    Code:
    document.getElementById("display_price").innerHTML =  xmlHttpObj.responseText;

    Add this right after:
    Code:
    $('#display_price').effect("pulsate", { times:3 }, 2000);

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2011
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you so much!


Tags for this Thread

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
  •