Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { "people": [
- { "firstName": "Brett", "lastName":"McLaughlin", "email": "brett@newInstance.com" },
- { "firstName": "Jason", "lastName":"Hunter", "email": "jason@servlets.com" },
- { "firstName": "Elliotte", "lastName":"Harold", "email": "elharo@macfaq.com" }
- ]}
- <people>
- <person>
- <firstName>Brett</firstName>
- <lastName>McLaughlin</lastName>
- <email>brett@newInstance.com</email >
- </person>
- <person>
- <firstName>Jason</firstName>
- <lastName>Hunter</lastName>
- <email>jason@servlets.com</email >
- </person>
- <person>
- <firstName>Elliotte</firstName>
- <lastName>Harold</lastName>
- <email>elharo@macfaq.com</email >
- </person>
- </people >
- public ContentResult ProcessRequestAction(string Email, string Password)
- {
- Product product = new Product();
- product.Name = "Apple";
- product.Expiry = new DateTime(2008, 12, 28);
- product.Price = 3.99M;
- product.Sizes = new string[] { "Small", "Medium", "Large" };
- return Content(JavaScriptConvert.SerializeObject(product));
- }
- $.ajax({
- type: "POST", /* GET OR POST */
- url: "JSON_MVC_URL_HERE", /* your url here */
- dataType: "json", /* json or xml */
- data: null, /* JSON CODE HERE TO SET GET OR POST BACK PARAMS */
- success: function(data){
- alert(data.Name); /* Gets Name Element */
- alert(data.Expiry); /* Gets Expiry Element */
- alert(data.Price); /* Gets Price Element */
- jQuery.each(data.Sizes, function() { /* Get Each Size */
- alert(this);
- });
- }
- });
Add Comment
Please, Sign In to add comment