Guest User

Untitled

a guest
Mar 21st, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. return Response()->json(array('error' => '404 car type not found'), 404);
  2.  
  3. $('document').ready(function () {
  4. $('#car_type').bind('changed.bs.select', function () {
  5. $.ajax({
  6. type: 'POST',
  7. url:'carclass/'+$('#car_type').val(),
  8. dataType: 'json',
  9. error: function(XMLHttpRequest, textStatus, errorThrown){
  10. alert('status:' + XMLHttpRequest.status + ', status text: ' + XMLHttpRequest.statusText);
  11. },
  12. success: function( json ) {
  13. $.each(json, function(i, obj){
  14. $('#car_class').append($('<option>').text(obj.name).attr('value', obj.id));
  15. });
  16. $('#car_class').selectpicker('refresh');
  17. }
  18. });
  19. });
  20. });
  21.  
  22. GET http://localhost:8000/ads/cartype/2 404 (Not Found)
  23.  
  24. error:function (xhr, ajaxOptions, thrownError){
  25. if(xhr.status==404) {
  26. alert(thrownError);
  27. }
  28. }
  29.  
  30. error:function (xhr, ajaxOptions, thrownError){
  31. if(xhr.status==404) {
  32. alert(thrownError);
  33. }
  34. }
Add Comment
Please, Sign In to add comment