skip to Main Content

my php isset is not working in POST method – Jquery ajax

This is my test.php code <input type="button" value="click me" name="my_btn" onclick="mybtn();"> <?php echo("before is set"); if(isset($_POST['hello'])=="dear"){ echo("after is set true"); } ?> <script src="vendor/jquery/jquery.min.js"></script> <script> function mybtn(){ $.ajax({ url:"http://localhost/mysites/php_two/test.php", method:"post", data:{hello:"dear"}, }); } </script> when button is clicked, page only…

VIEW QUESTION

Ajax form Submit vizualizing the php file – Jquery ajax

This is the js <script> $(document).ready(function() { $("#create-admin").submit(function(e) { var forms = document.getElementsByClassName('needs-validation'); if(forms == null) { $.ajax({ type: "POST", url: "crud_admin.php", dataType: "html", data: $("#create-admin").serialize() }).done(function(data){ toastr.success(data, 'Success Alert', {timeOut: 5000}); }) } /**/ }) }) this is the…

VIEW QUESTION

jquery ajax post with location.href in data is not working

What is preventing type POST from getting the expected result if using location.href (or window.location.href) as data? This code is not working (it returns nothing): $.ajax({ type: "POST", url: 'page.asp', data: {'q': location.href}, success: function(short_link,status){ console.log('short_link = '+short_link); console.log('status =…

VIEW QUESTION
Back To Top
Search