Web Analytics Made Easy -
StatCounter Jquery Ajax (dynamic var) - CodingForum

Announcement

Collapse
No announcement yet.

Jquery Ajax (dynamic var)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jquery Ajax (dynamic var)

    I want to pass the "divId' function so that i can grab functions dynamically into the server where "success" is. this possible? I know the current setup is not (because " d.divId " isn't a variable)

    Code:
    function run(times,divId)
    {
    	$(function() 
    	{
    		var client_id = $('#client_id').attr('value');
    		$.ajax(
    		{
    			url:'http://urlhere.com',
    			data:{c:client_id},
    			timeout:99999999999999,
    			dataType:'jsonp',
    			jsonp:'callback',
    			jsonpCallback:'jsonpCallback',
    			error:function()
    			{
    				if (times==1)
    				{
    					run(2);
    				}
    				else
    				{
    					$('#'+divId).html('Error') 
    				}
    			},
    			success:function(d)
    			{
    				$('#'+divId).html('$'+d.divId);
    			}
    		});
    }
Working...
X