Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function()
- {
- $("#form1").validationEngine({
- ajaxSubmit: true,
- ajaxSubmitFile: "note/note.php",
- success: false
- });
- if (success == "true")
- {
- function()
- {
- window.alert("Report Sent!");
- //write a confirmation to the user
- document.getElementById("update").innerHTML="Report Sent!";
- setTimeout(function()
- {
- document.getElementById("update").innerHTML="";
- },3000);
- }
- }
- });
- $(document).ready(function()
- {
- $("#form1").validationEngine({
- ajaxSubmit: true,
- ajaxSubmitFile: "note/note.php",
- success: false
- });
- if (success == "true")
- {
- function()
- {
- $(document).ready(function()
- {
- $("#form1").validationEngine({
- ajaxSubmit: true,
- ajaxSubmitFile: "note/note.php",
- success: function(response)//response is what the php script returns
- {
- //the function from your if branch goes here
- }
- });
- $(document).ready(function()
- {//notice the curly braces around what you're passing to validationEngine
- $("#form1").validationEngine({
- ajaxSubmit: true,
- ajaxSubmitFile: "note/note.php",
- success: function(response)
- {
- if (response !== 'true')
- {
- if (window.console)
- {
- console.log(response);
- alert('check your console to see the response');
- }
- else
- {
- alert(response);
- }
- return;
- }
- alert("Report Sent!");//no need for window here
- document.getElementById("update").innerHTML="Report Sent!";
- setTimeout(function()
- {
- document.getElementById("update").innerHTML="";
- },3000);
- }
- });
- //As I said, you're passing an object, so you could write the code above like so:
- var validationArgs = {ajaxSubmit:true,ajaxSubmitFile:'note/note.php'};
- validationArgs.success = function()
- {
- //your function
- };
- $('#form1').validationEngine(validationArgs);
- });
- $(document).ready(function() {
- var update = $("#update");
- // Callback
- var onSuccess = function() {
- alert("Report Sent!");
- //write a confirmation to the user
- update.html("Report Sent!");
- setTimeout(function(){
- update.html("");
- },3000);
- };
- $("#form1").validationEngine({
- ajaxSubmit: true,
- ajaxSubmitFile: "note/note.php",
- success: onSuccess
- });
- });
Add Comment
Please, Sign In to add comment