Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

ajax call with form data

$.ajax({
    url: "jobs/php/job_single.php?type=500",
    type: "POST",
    data:  new FormData(document.getElementById("form")),
    contentType: false,
    processData:false,
    cache: false,
    success: function(dataResult){
      console.log(dataResult);
      if(dataResult == 999){
        alert("Incomplete Information Provided");
      }
      else{
        if(dataResult == 1){
        	alert("Job Application successful");
        	location.reload();
        }
        else if(dataResult == 0){
        	alert("Error applying for job, Please try again");
        }

      }
    }
}); 
Comment

ajax get form data

var form = // Select your form here;
var fmData = new FormData();
form.append('name',fmData);
$.ajax({
  url:'URL',
  type:'POST',
  data:fmData,
  success:function(){},
  error:(er){}
})
Comment

.ajax how to get data from form

$.ajax({
    ...
    data: $("#registerSubmit").serialize(),
    ...
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: nodejs on exit event 
Javascript :: try catch in node js 
Javascript :: object delete with id filter javascript 
Javascript :: alternate color to table row jquery 
Javascript :: phaser 3 add button 
Javascript :: jest expect error to be thrown 
Javascript :: js date format mm/dd/yyyy 
Javascript :: how to find the last object in an array 
Javascript :: how to check if array is empty or not in javascript 
Javascript :: jquery image change on hover 
Javascript :: javascript window.history.pushstate 
Javascript :: disable submit button until checkbox is checked javascript 
Javascript :: traverse an array in javascript 
Javascript :: angular get first element ngfor 
Javascript :: html string to object jquery 
Javascript :: iterate 0 to n using for loop javascript 
Javascript :: how to divide array in chunks 
Javascript :: free robux javascript 
Javascript :: apk react native 
Javascript :: assign an element value as key in array of objects 
Javascript :: js select element by css selector 
Javascript :: javascript domcontentloaded 
Javascript :: javascript colorized console.log 
Javascript :: get element by id in javascript 
Javascript :: remove single item from array in angular 
Javascript :: js string length 
Javascript :: sort javascript array 
Javascript :: js get object properties 
Javascript :: how could you implement javascript into java 
Javascript :: install proptypes react 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =