Every line of 'ajax form submit' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
89 function formSubmit() { 90 $.ajax({ 91 type: "POST", 92 url: "http://localhost:3000/api/v1/session/login", 93 data: $('#inputForm').serialize(), 94 timeout: 2000, 95 success: function(data, textStatus, xhr) { 96 if (data === null || data.length == 0) { 97 alert("No data found."); 98 } else { 99 alert("Welcome " + data.name); 100 $('input[name="password"]').val(''); 101 } 102 }, 103 error:function(err) { 104 alert(jQuery.parseJSON(err.responseText ).message); 105 }, 106 dataType: 'json' 107 }); 108 }
86 function formSubmit() { 87 $.ajax({ 88 type: "PUT", 89 url: "http://localhost:3000/api/v1/user", 90 data: $('#inputForm').serialize(), 91 success: function(data) { 92 alert("Success"); 93 }, 94 error:function(err) { 95 console.log(err); 96 alert(JSON.parse(err.responseText).message) 97 }, 98 dataType: 'json' 99 }); 100 }
54 function formSubmit() { 55 $.ajax({ 56 type: "POST", 57 url: "http://localhost:3000/api/v1/systemMessage", 58 data: $('#selectForm').serialize(), 59 success: function(data) { 60 if (data === null || data.length == 0) { 61 alert("No data found."); 62 } else { 63 console.log(data); 64 clearForm(); 65 alert('Sent'); 66 } 67 }, 68 error:function(err) { 69 console.log(err); 70 alert(JSON.parse(err.responseText).message) 71 }, 72 dataType: 'json' 73 }); 74 }
63 function formSubmit() { 64 $.ajax({ 65 type: "DELETE", 66 url: "http://localhost:3000/api/v1/admin/user", 67 data: $('#selectForm').serialize(), 68 success: function(data) { 69 if (data === null || data.length == 0) { 70 alert("No data found."); 71 } else { 72 console.log(data); 73 loadData(); 74 } 75 }, 76 error:function(err) { 77 console.log(err); 78 alert(JSON.parse(err.responseText).message) 79 }, 80 dataType: 'json' 81 }); 82 }
82 function formSubmit() { 83 $.ajax({ 84 type: "POST", 85 url: "http://localhost:3000/api/v1/messageThread", 86 data: $('#selectForm').serialize(), 87 success: function(data) { 88 if (data === null || data.length == 0) { 89 alert("No data found."); 90 } else { 91 console.log(data); 92 clearForm(); 93 loadData(); 94 alert('Sent'); 95 } 96 }, 97 error:function(err) { 98 console.log(err); 99 alert(JSON.parse(err.responseText).message) 100 }, 101 dataType: 'json' 102 }); 103 }
10 function SubmitAjax(formElement){ 11 12 if(formElement.method.toUpperCase()==='POST'){ 13 if(formElement.hasAttribute('action')){ 14 xhr.open("post",formElement.action,true); 15 if(window.FormData){ 16 var formData = new FormData(formElement); 17 xhr.send(formData); 18 19 }else{ 20 21 var search=''; 22 23 for(var nItem=0;nItem
68 function formSubmit() { 69 if ($('input[name="itemsPerPage"]').val() >= 1) { 70 if ($('input[name="pageNumber"]').val() == '') { 71 $('input[name="pageNumber"]').val('1') 72 } 73 } 74 $.ajax({ 75 type: "GET", 76 url: "http://localhost:3000/api/v1/userlist", 77 data: $('#inputForm').serialize(), 78 success: function(data) { 79 if (data === null || data.length == 0) { 80 alert("No data found."); 81 } else { 82 $('input[name="pages"]').val(data.pageCount); 83 //console.log(data); 84 buildTable(data.users) 85 /* 86 var userArr = data.users; 87 for (i = 0; i < userArr.length; i++) { 88 console.log(i + ":" + userArr[i]); 89 } 90 */ 91 } 92 }, 93 error:function(err) { 94 console.log(err); 95 alert(JSON.parse(err.responseText).message) 96 }, 97 dataType: 'json' 98 }); 99 }
76 function formSubmit() { 77 $('input[name="id"]').val(''); // Safety, doesn't seem like this is required: if user resubmitting modified form data clear out the ObjectId 78 var stt = "username='"+$('input[name="username"]')+"'&id="+"'"+$('input[name="id"]')+"'"; 79 $.ajax({ 80 type: "GET", 81 url: "http://localhost:3000/api/v1/user/username/exists", 82 data: $('#inputForm').serialize(), 83 success: function() { 84 $.ajax({ 85 type: "POST", 86 url: "http://localhost:3000/api/v1/user", 87 data: $('#inputForm').serialize(), 88 success: function(data) { 89 $('input[name="id"]').val(data._id); 90 alert('Use the HTTP link in your email to validate this account.'); 91 }, 92 error: function(err) { 93 //console.log(err.responseText); 94 alert(JSON.parse(err.responseText).message); 95 }, 96 dataType: 'json' 97 }); 98 }, 99 error: function(err) { 100 // console.log(err); 101 alert(JSON.parse(err.responseText).message); 102 }, 103 dataType: 'json' 104 }); 105 }
145 function submitForm() { 146 $("#realForm").attr("action", GPC.url.saveImage); 147 $('#realForm').ajaxForm({ 148 dataType : "json", 149 error : function(request) { 150 dhtmlx.alert("上传失败" + request.responseText); 151 }, 152 success : processJson 153 }); 154 155 $("#realForm").submit(); 156 }
49 function formSubmit() { 50 // /api/v1/user returns the current user with no path mod 51 // /api/v1/user/:id replace :id with the id to search for, requires admin access 52 // /api/v1/user/:username replace :username with the username to search for, requires admin access 53 var path = "http://localhost:3000/api/v1/user"; 54 55 if ($('input[name="id"]').val().length > 0) { 56 path = path + "/" + $('input[name="id"]').val(); 57 } else if ($('input[name="username"]').val().length > 0) { 58 path = path + "/" + $('input[name="username"]').val(); 59 } 60 $.ajax({ 61 type: "GET", 62 url: path, 63 data: '', 64 success: function(data) { 65 if (data === null || data.length == 0) { 66 alert("No data found."); 67 } else { 68 console.log(data); 69 $('input[name="id"]').val(data._id); 70 $('input[name="name"]').val(data.name); 71 $('input[name="role"]').val(data.role); 72 $('input[name="username"]').val(data.username); 73 $('input[name="email"]').val(data.email); 74 $('input[name="password"]').val(data.hashed_password); 75 } 76 }, 77 error:function(err) { 78 console.log(err); 79 alert(JSON.parse(err.responseText).message) 80 }, 81 dataType: 'json' 82 }); 83 }