coder71 Posted May 27, 2014 Share Posted May 27, 2014 I have a PHP page that makes a checkbox appear after a certain textbox is exited. This part of the functionality is working - the user leaves the textbox, the AJAX call is made, and if certain criteria are met, the checkbox appears or it doesn't. Here's where I need help. When the checkbox appears on the form and the form is submitted via POST, I can't get its value. Here's the code that's in the HEAD section: <script type="text/javascript"> $(document).ready(function() { $('#id2').blur(function(){ $.post("biz/add_official.php", { id1: $('#id1').val(), id2: $('#id2').val() }, function(response){ $('#usernameResult').fadeOut(); setTimeout("finishAjax('usernameResult', '"+escape(response)+"')", 400); }); return false; }); }); function finishAjax(id, response) { /* $('#usernameLoading').hide();*/ $('#'+id).html(unescape(response)); $('#'+id).fadeIn(); } //finishAjax </script> And here's the code that's in the FORM section: <span id="usernameResult" style="color:green;"></span> <script> $('.container').find('.checkOfficial input[type="checkbox"]').val() </script> When the form is submitted via POST, how do I see if checkbox was checked or unchecked? Both of these variables appear empty when the form is submitted: $_POST['checkOfficial'] $_POST['usernameResult'] Link to comment https://forums.phpfreaks.com/topic/288819-need-help-reading-a-variable-from-ajax/ Share on other sites More sharing options...
coder71 Posted May 28, 2014 Author Share Posted May 28, 2014 Moderator, if you would please delete this post I'd appreciate it. I'm a little lost right now on this. Thanks! Link to comment https://forums.phpfreaks.com/topic/288819-need-help-reading-a-variable-from-ajax/#findComment-1481118 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.