ChatGPT 🤖 Posted August 1, 2024 Share Posted August 1, 2024 I have a page with many forms as: <div class="que_text">1. how ...............ike.</div><div class="que_ans">what<div class="icon tick "><i class="fas fa-check"></i></div> </div> <footer><form id="aAns1" method="POST" action=""> <input type="hidden" name="sAction" value="addAns"> <button class="Add_ans">Add answer</button></form><form id="eAns1" method="POST" action=""> <input type="hidden" name="sAction" value="editAns"> <button class="Edit_ans">Edit answer</button></form> <form id="aQue1" method="POST" action=""> <input type="hidden" name="sAction" value="editQue"> <button class="nxt_btn Edit_que" id="Edit_que">Edit / Add to Question</button></form> </footer><div class="que_text">2. John......that she had stolen his friend's money.</div><div class="que_ans">say<div class="icon tick "><i class="fas fa-check"></i></div> </div> <footer><form id="aAns2" method="POST" action=""> <input type="hidden" name="sAction" value="addAns"> <button class="Add_ans">Add answer</button></form><form id="eAns2" method="POST" action=""> <input type="hidden" name="sAction" value="editAns"> <button class="Edit_ans">Edit answer</button></form> <form id="aQue2" method="POST" action=""> <input type="hidden" name="sAction" value="editQue"> <button class="nxt_btn Edit_que" id="Edit_que">Edit / Add to Question</button></form> </footer> And i try to post to php as: $("button.Add_ans").click(function (e){ e.preventDefault(); var formData = $(this).closest('form').serialize(); // Loads the event data from the DB $.ajax({ type: "POST", url:'/Addanswer.php', data: formData, dataType: 'json', cache:false, //encode:true, success: function(response){ //console.log(JSON.stringify(response)); // Alert event data for now alert(response); }); } }); }); My problem is that when i have more than 4 questions the ajax fails to work especially after the 5th question on page. what is wrong here because i xpect to have more than 50 questions Quote Link to comment https://forums.phpfreaks.com/topic/322778-ajax-fails/ Share on other sites More sharing options...
ChatGPT 🤖 Posted August 1, 2024 Share Posted August 1, 2024 Have you checked your network responses in your browser's developr tools? Quote Link to comment https://forums.phpfreaks.com/topic/322778-ajax-fails/#findComment-1631778 Share on other sites More sharing options...
ChatGPT 🤖 Posted August 1, 2024 Author Share Posted August 1, 2024 On 8/1/2024 at 10:56 AM, Barand said: Have you checked your network responses in your browser's developr tools? Expand how do i do that Quote Link to comment https://forums.phpfreaks.com/topic/322778-ajax-fails/#findComment-1631789 Share on other sites More sharing options...
Solution ChatGPT 🤖 Posted August 1, 2024 Solution Share Posted August 1, 2024 Select "Developer tools" in browser menu Open network tab. Instigate the AJAX request When ajax call appears in network window, click on it Select response tab to response or request tab to see request Quote Link to comment https://forums.phpfreaks.com/topic/322778-ajax-fails/#findComment-1631791 Share on other sites More sharing options...
ChatGPT 🤖 Posted August 1, 2024 Author Share Posted August 1, 2024 On 8/1/2024 at 2:55 PM, shadd said: how do i do that Expand i got this screen shot and do not know what to make of it; Quote Link to comment https://forums.phpfreaks.com/topic/322778-ajax-fails/#findComment-1631792 Share on other sites More sharing options...
ChatGPT 🤖 Posted August 1, 2024 Share Posted August 1, 2024 First, click on the error notification and sort out the error. Then try again. Quote Link to comment https://forums.phpfreaks.com/topic/322778-ajax-fails/#findComment-1631793 Share on other sites More sharing options...
ChatGPT 🤖 Posted August 1, 2024 Author Share Posted August 1, 2024 On 8/1/2024 at 3:09 PM, shadd said: i got this screen shot and do not know what to make of it; Expand Thanks I saw a n error Fatal error: Uncaught Error: Call to undefined function cont() in D:\.....\.........\Addanswer.php:83 .So i will work on that Quote Link to comment https://forums.phpfreaks.com/topic/322778-ajax-fails/#findComment-1631795 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.