Skip to content
Advertisement

Why is there a 0 appearing before selecting from dropdown PHP & Ajax

I have 2 dropdown boxes, when you select from the first dropdown which is a main category, the second one will then load subcategories for the user to select from.

However, on selecting from the first category dropdown a 0 then shows below the second.

Before selection:

Then when you select a category a 0 shows

after select

Can anyone assist to why this is happening please, Here is my code

JavaScript

Advertisement

Answer

At the end of the function getSubCat , add this

JavaScript

This will solve the issue.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement