javascript - Error handling for Remote Autocomplete is not working -
javascript - Error handling for Remote Autocomplete is not working -
i have jquery autocomplete code.everything works fine info loaded etc.success working.but when have error...error handling not working in below code.
$("#autocomplete").on("filterablebeforefilter", function (e, data) { if (value && value.length > 0) { //$ul.listview("refresh"); $('.ui-responsive-panel').enhancewithin(); $.ajax({ type: "get", url: "http://domain.com/food.php", datatype: "jsonp", crossdomain: true, data: $(this).serialize(), success: function (data) { alert("success"); }, error: function () { alert("an error occurred!"); }, beforesend: function () { // callback function trigger before info sent }, complete: function () { settimeout(function () {}, 1); } }) .then(function (response) { $.each(response, function (i, val) { //do info }); } });
as jquery doc states jquery.ajax error handler functions:
note: this handler not called cross-domain script , cross-domain jsonp requests.
it related technique of jsonp actual request injected <script>
tag. standard jqxhr object including ajax error event isn't available. there's plugin workaround available. plugin , solutions dealing network timeouts discussed e.g. in this , this stackoverflow questions.
javascript jquery json
Comments
Post a Comment