TeddyKiller Posted May 15, 2010 Share Posted May 15, 2010 My code is below. I'm wanting to pass the php variable $db, to the function called. The line where I'm having issues is db: <?php echo $db ?> $(document).ready(function() { $('#wait_1').hide(); $('#drop_1').change(function(){ $('#wait_1').show(); $('#result_1').hide(); $.get("func.php", { func: "drop_1", drop_var: $('#drop_1').val() db: <?php echo $db ?> }, function(response){ $('#result_1').fadeOut(); setTimeout("finishAjax('result_1', '"+escape(response)+"')", 400); }); return false; }); }); How can it be done? Thanks Quote Link to comment Share on other sites More sharing options...
CodeMaster Posted May 15, 2010 Share Posted May 15, 2010 You need to put quotes around the value and a comma on the line above. Like this: $(document).ready(function() { $('#wait_1').hide(); $('#drop_1').change(function(){ $('#wait_1').show(); $('#result_1').hide(); $.get("func.php", { func: "drop_1", drop_var: $('#drop_1').val(), db: "<?php echo $db ?>" }, function(response){ $('#result_1').fadeOut(); setTimeout("finishAjax('result_1', '"+escape(response)+"')", 400); }); return false; }); }); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.