slouma2000
10/20/2014 - 11:03 AM

Ajax jQuery

Ajax jQuery

var url = 'participants/save';
$.ajax({
  dataType: 'json',
  type: 'POST',
  url: url,
  cache: false,
  data: {
    fbid: response.id,
    fullname: response.name,
    firstname: response.first_name,
    lastname: response.last_name,
    email: response.email
  },
  success: function(data) {
    var baseUrl = data.url;
    if (data.success == true) {
      window.location.href = baseUrl;
    } else {
      //alert("not saved");
    }
  },
  error: function(jqXHR, textStatus, errorThrown) {
    //alert("status=" + jqXHR.status);
    // Une erreur s'est produite lors de la requete
  }
});