Home
Q&A
Education
Technology
Credit
General
Health
Insurance
Questions
Ask a Question
after form submit in jQuery completed in PHP
Home
Education
after form submit in jQuery completed in PHP
asked
Feb 13, 2022
in
Education
by
JackTerrance
I have a php file and it contains a textfiled and submit button and a div and below is code Page1.php
You have Entered
if($_POST['submit']) { $v1 = $_POST['email1']; // $query1 = here some code to insert into database if($query1 > 0){ //here i want to display the div `suc_box`.. Here how i can show that div } } And the jQuery code: $(document).ready(function(){ $('suc_box').hide(); $('suc_box').click(function(){ $(this).hide(); }); }); Question: How can I show/display that suc_box when form is submitted after it inserted into database? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)
phpjavascriptjquery
1
Answer
0
votes
answered
Feb 13, 2022
by
JackTerrance
You can do it easily with AJAX. You have one php-file with the form and another one for processing the data: //form_file.php
$(document).ready(function(){ $('.suc_box').click(function(){ $(this).hide(); }); $('#my_form').submit(function(){ var data = $(this).serialize(); $.post('process.php',data,function(return_data){ $('.suc_box').html(return_data); }); return false; //cancel the 'real' submit }); }); //process.php <?php $email = mysql_real_escape_string($_POST['email1']); //write data to DB if($succeeded) { echo 'You have Entered'; } else { echo 'Something went wrong, try again!'; } It's untested, but you get the idea. validating email field function validateform(){ if (!/^\S+@\S+\.\w+$/.test(document.sweetform.Email.value)) { alert("Not a valid e-mail address"); return false; } else { return true; } }
Related questions
0
votes
Q: after form submit in jQuery completed in PHP
I have a php file and it contains a textfiled and submit button and a div and below is code Page1 ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked
Feb 13, 2022
in
Education
by
JackTerrance
phpjavascriptjquery
0
votes
Q: How to make Textarea and submit button in .php file hide for every row in database?
been working on some database data calling into a .php file. The php file contains an "Add" button ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked
Jul 20, 2022
in
Education
by
JackTerrance
phpjquery
0
votes
Q: HTML website Javascript alert after php form submission
I have Html website. There is newsletter signup form in the html. It is processed by php script file ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked
Jun 2, 2022
in
Education
by
JackTerrance
javascriptphp
0
votes
Q: HTML website Javascript alert after php form submission
I have Html website. There is newsletter signup form in the html. It is processed by php script file ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked
May 17, 2022
in
Education
by
JackTerrance
javascriptphp
0
votes
Q: HTML website Javascript alert after php form submission
I have Html website. There is newsletter signup form in the html. It is processed by php script file ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked
May 14, 2022
in
Education
by
JackTerrance
javascriptphp
0
votes
Q: Close Bootstrap modal on form submit
I have a Bootstrap modal dialog which contains a form. The modal dialog contains a submit and a cancel ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked
Apr 2, 2022
in
Education
by
JackTerrance
javascripthtmljquery
0
votes
Q: 9. Cancel button (x on formula bar) can be used to undo a cell entry after it has been completed
9. Cancel button (x on formula bar) can be used to undo a cell entry after it has been completed (a) True (b) ... ) Alt+P (d) Ctrl+P Select the correct answer from above options...
asked
Dec 13, 2021
in
Education
by
JackTerrance
computer-science-interview-questions
computer-science-questions
0
votes
Q: Updating table with form using PHP to MS SQL
I am struggling trying to update a row in an Azure SQL database. What I am trying to do is to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked
Apr 23, 2022
in
Education
by
JackTerrance
phpsqlsql-server
0
votes
Q: Magento: send contact form with jquery
How can I edit the default Magento contact form to send email with jquery, without quitting the contact ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked
Feb 18, 2022
in
Education
by
JackTerrance
jqueryajax
0
votes
Q: Magento: send contact form with jquery
How can I edit the default Magento contact form to send email with jquery, without quitting the contact ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked
Feb 18, 2022
in
Education
by
JackTerrance
jqueryajax
0
votes
Q: jQuery DataTables: different width of the columns when the page loads and after it resize
$('#some-table').DataTable({ "language": { "url": "{{ asset('/js/plugins/lang.json') }} ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked
Jul 26, 2022
in
Education
by
JackTerrance
jquerydatatable
0
votes
Q: jQuery DataTables: different width of the columns when the page loads and after it resize
$('#some-table').DataTable({ "language": { "url": "{{ asset('/js/plugins/lang.json') }} ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked
Jul 20, 2022
in
Education
by
JackTerrance
jquerydatatable
0
votes
Q: Using jQuery to set Title on attribute in parallel with CSS3 :after
Hi i'm using this to set a title attribute on elements: $('.upgradeTables thead tr td:gt(1)'). ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked
Mar 2, 2022
in
Education
by
JackTerrance
csscss-selectors
0
votes
Q: Which hormone is released from pituitary of mother once the foetal development is completed?
Which hormone is released from pituitary of mother once the foetal development is completed? Select the correct answer from above options...
asked
Nov 9, 2021
in
Education
by
JackTerrance
science-interview-questions
science-interview-questions-answers
science-multiple-choice-questions
science-mcq-with-answers
science-mcq
science-questions
0
votes
Q: _______ means that data used during the execution of a transaction cannot be used by a second transaction until the first one is completed.
_______ means that data used during the execution of a transaction cannot be used by a second transaction ... Database Interview Questions and Answers for Freshers and Experience...
asked
Oct 11, 2021
in
Education
by
JackTerrance
...