Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. alert(myJSON) outputs:
  2. [{"breed":{"msg":"Breed is required","placement":"#breed_error_1","return":"false"}},{"breed":{"msg":"Breed does not exist","placement":"#breed_error_2","return":"true"}}]    
  3.  
  4.     function validateElement(formId, elementSelector, element, validateElement, errorContainer)
  5.     {
  6.         $.ajax({
  7.             type: 'POST',
  8.             cache: false,
  9.             url: "validate_breed",
  10.             data: element+"="+$(elementSelector).val()+"&v="+validateElement,
  11.             context: document.body,
  12.             dataType: 'JSON',
  13.             success: function(myJSON){
  14.                 alert(myJSON);
  15.                
  16.                 for(var i=0;i<myJSON.length; i++){
  17.                      console.log(myJSON[i].breed.return);
  18.                 }
  19.             }
  20.         });
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement