javascript - Why isn't AJAX $.post working in wordpress?
Get the solution ↓↓↓Solution:
If I leave that on, the code does not work as far as ajax
That's because you have a syntax error, so none of the JavaScript is going to work.
Notice the syntax highlighting here on Stack Overflow:
$( "#chained-subcontainer" ).html( "<select name="chained-subcategories" id="chained-subcategories"><option value="">- Select a category first -</option></select>" );
^--- here
In this case, the easiest solution is simply to use single-quotes for your strings. Since your strings don't themselves contain single-quotes (but do dontain double-quotes):
$( '#chained-subcontainer' ).html( '<select name="chained-subcategories" id="chained-subcategories"><option value="">- Select a category first -</option></select>' );
Any time a string contains a quote character, you have to ensure that the parser isn't going to interpret that character as being the end of the string. Either by using different kinds of quotes or by "escaping" those quote characters.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: composer detected issues in your platform: your composer dependencies require a php version ">= 7.3.0".
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.