I’m trying to create an Ajax call which is triggered when a Select box changes. It loads another PHP function using
$('.selectbox').load("/path/to/script.php?x=" + x + "&y=" + y);
This call is successfull since I can see in Firebug that the call returns the HTML from the PHP (which are in fact <option> tags). However, this HTML is not placed into the .selectbox element. What am I doing wrong?
Your code seems correct. Make sure you get the proper HTML markup to be inserted into
<select>. The expected response is<option value="1">1</option><option value="2">2</option>Or Try using other Ajax methods like $.get or $.ajax
Demo: http://jsfiddle.net/TVZbS/