Ajax Query will not send post value to php -
i have looked everywhere , can't seem figure out problem in code is.
i have table radio button in php need id of button , use in sql query. have used ajax id , can alert value need, problem can not seem id value post $_post['id']; in php. stays blank. code on same page.
<script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function() { $('table tr').click(function() { $(this).find('input[type=radio]').prop('checked', true); var temp = parseint($(this).find('input[type=radio]').attr("id"), 10); ++temp; $.post(window.location, { 'ident': temp }); $.ajax({ type: "post", url: window.location, data: {ident: temp}, }); }); }); </script>
this javascript retrieving value in can alert(temp) , see desired result. echo $_post['ident']; stays empty.
sorry if obvious question new both php , javascript
$.post(window.location, { 'ident': temp }); //<----- ident: temp $.ajax({ type: "post", url: window.location, data: {ident: temp}, //<----- del comma });
Comments
Post a Comment