On the page I have the query AJAX to show the data autocomplete. I checked sql query, database , everything ok, but the field autocomplete using AJAX not work. So how to fix it? On this host I can’t uset AJAX?
(please share the FULL error message you see, if applicable)
There are some restrictions on using AJAX with our hosting. Notably: you cannot use AJAX endpoints on your website with us from another other website other than your own. However, using AJAX on your own website to connect to endpoints on the same domain.
In short: by debugging it.
It’s your website and your code. You and only you know how it works so only you can fix it.
Some things you could check:
Check the Network tab in your browser. Is the AJAX request being fired? Does it hit the right URL? Does it send the right input data? What does the API call return? Does it have a successful status code? Does the output format match? Does it return the expected data?
If you have established that your frontend sends the right request, what happens on the backend? Is the correct database query generated? Does the query run successfully? Does it return the correct data? Is the query response converted correctly? Adding var_dump() and die() statements throughout the code can help show the internal state, which you can then view through the Network tab from your browser.
If you think “geesh, that sounds like a lot of work”, I completely understand. But if you are building your website, that means you are also responsible to troubleshoot and fix issues.
If you are having trouble with a specific issue, we’re happy to help. But then please be specific. Don’t just share a URL we can’t access with the message that it “not work”. Share what you see, share what you were able to find out yourself, share relevant code snippets and what it does.
Remember: it’s your website, and we know nothing about your website except for what you choose to share with us.
Please read my message again, try the things I suggested to try, and share your findings.
So far, I know nothing about the issue. You shared some jQuery code, but that’s only one piece of the whole puzzle, and nowhere near enough to say something useful. Based on the information provided so far, I don’t even know if the problem is with the jQuery code to being with.
Remember, it’s your website and your code, so it’s your responsibility to fix it. We can help you to fix it, but that doesn’t mean that we will fix it for you.
Please do some investigation yourself and ask clear, specific questions, or nobody will be able to help you.