JQuery Autocomplete works in Chrome but not in android using telephone interchange

I have a simple autocomplete code for searching. I am developing an Android application using PhoneGap. I have autocomplete code for searching, and it works fine, but when I am going to run in android, it does not work.

Here is a sample code

I use the same file, not one change. Google Chrome allows you to test the pages of the HTML 5 database, so first I check it in the browser, and then copy all the files to the device.

Here is my code

I have my dynamic function, which returns an array from a database, and also works in Google Chrome, and I can see the perfect result according to the database.

When I run the code on the device, I always get below the error:

TypeError: Result of expression '$( "#pur_cat_text" ).autocomplete' [undefined] is not a function. 

I don’t know where the problem is and how to solve it. Please guild, how can I solve this.

Thanks for the read request.

+4
source share
1 answer

Oh, after almost half a day, finally, I found the exact solution.

The problem was with the Live Script URL.

In the sample code, they set the live Script URL, and I did not save it locally.

 <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> 

So it can be on mobile that all js and css are not loading, so for this reason they cannot find

'$( "#pur_cat_text" ).autocomplete' and giving me an error.

Finally, I save both JS and CSS locally, and now I can run my code

+5
source

Source: https://habr.com/ru/post/1500910/


All Articles