Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,555
    Thanks
    57
    Thanked 148 Times in 147 Posts

    AJAX activation on multipul drop dorwns

    Hi i have the following code:

    Code:
    <script type="text/javascript">
    jQuery(document).ready(hostCalc);
    function hostCalc(){
    	$("SELECT").change(function(){
    		var diskSpace = jQuery("#diskSpace :selected").text();
    		var bandwidth = jQuery('#bandwidth :selected').text();
    		var subDomains = jQuery('#subDomains :selected').text();
    		var additionalFTP = jQuery('#additionalFTP :selected').text();
    		var mysqlDatabases = jQuery('#mysqlDatabases :selected').text();
    		var emailForwarding = jQuery('#emailForwarding :selected').text();
    		var AutoResponders = jQuery('#autoResponders :selected').text();
    		var emailDistributionLists = jQuery('#emailDistributionLists :selected').text();
    		var mailBoxes = jQuery('#mailBoxes :selected').text();
    		var operatingSystem = jQuery('#operatingSystem :selected').text();
    		var oneClick = jQuery('#oneClick :selected').text();
    		
    		$.ajax({
    			type: "GET", 
    			data: 'discSpace=' + discSpace + '&bandwidth=' + bandwidth + '&subDomains=' + subDomains + '&additionalFTP=' + additionalFTP + '&mysqlDatabases=' + mysqlDatabases + '&emailForwarding=' + emailForwarding + '&AutoResponders=' + AutoResponders + '&emailDistributionLists=' + emailDistributionLists + '&mailBoxes=' + mailBoxes + '&operatingSystem=' + operatingSystem + '&oneClick=' + oneClick, 
    			url: 'hostCalc.php', 
    			cache: false, 
    			timeout: 1000, 
    			error: function(){
    			},
    			success: 
    			function(html){
    				$("#cost").html(html);
    			}
    		});
    	});
    }
    </script>
    the hostCalc.php simply :
    PHP Code:
    <?php
    echo "foo";
    ?>
    i seem to get no response back from the php script. Anyone know why?

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    what does fiddler or firebug say comes back?

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Instead of getting every single form element, you can use seralize.

    Code:
    $("#formId").serialize();
    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]


  •  

    Posting Permissions

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