Advertisement
Guest User

Untitled

a guest
Oct 24th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. $("#main").on("submit", "#searchForm", function (event) {
  2. event.preventDefault();
  3. $.ajax({
  4. url: "search.php",
  5. method: "POST",
  6. data: $(this).serialize(),
  7. dataType: 'json',
  8. success: function (response) {
  9. $("#queryArea").text(response.query);
  10. $("#numberDocuments").html(response.numberDocuments);
  11. $("#foundDocuments").html("");
  12. for (var key in response.found) {
  13. $("#foundDocuments").append(response.found[key] + '<br>');
  14. }
  15. },
  16. error: function (xhr, status, error) {
  17. console.log(error);
  18. console.log(xhr.responseText);
  19. alert(status);
  20. }
  21. });
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement