Advertisement
Guest User

Untitled

a guest
Sep 18th, 2015
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function testAjax() {
  2.         $.get("/Blog/getTestEntity", function(data) {
  3.             alert(data.id + " " + data.text);
  4.         });
  5.         //  $.ajax({
  6.         //     url: "/Blog/getTestEntity",
  7.         //     type: 'GET',
  8.         //     dataType: 'json',
  9.         //     contentType: 'application/json',
  10.         //     mimeType: 'application/json',
  11.         //     success: function(data) {
  12.         //         alert(data.id + " " + data.text);
  13.         //     },
  14.         //     error:function(data,status,er) {
  15.         //         alert("error: "+data+" status: "+status+" er:"+er);
  16.         //     }
  17.         // });
  18.     }
  19.     function testAjax2() {
  20.          $.post("/Blog/postTestEntity",
  21.                     {
  22.                         id: 4,
  23.                         text: "text"
  24.                     },
  25.                     function(data, status){
  26.                         alert("Data: " + data + "\nStatus: " + status);
  27.                     });
  28. //      $.ajax({
  29. //          url : "/Blog/setTestEntity",
  30. //          type : 'POST',
  31. //          data : "{\"id\":3,\"text\":\"3\"}",
  32. //          dataType : 'json',
  33. //          contentType : 'application/json',
  34. //          mimeType : 'application/json',
  35. //          success : function(data) {
  36. //              alert(data.id + " " + data.text);
  37. //          },
  38. //          error : function(data, status, er) {
  39. //              alert("error: " + data + " status: " + status + " er:" + er);
  40. //          }
  41. //      });
  42.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement