Wednesday, July 10, 2013

Jquery Ajax call back for php

$("#btnAjax").click(function () {

  $.ajax({
    type: "GET", //GET or POST or PUT or DELETE verb
    url: 'test.php', // Location of the service
    data: "", //Data sent to server
    contentType: "", // content type sent to server
    dataType: "json", //Expected data format from server
    processdata: true, //True or False
    success: function (json) {//On Successful service call
      var result = json.name;
      $("#dvAjax").html(result);
    },
    error: ServiceFailed // When Service call fails
  });

  return false;
});

No comments:

Post a Comment