Ajax appended drop down submitting null value

Ajax appended drop down submitting null value

I am using the following code to clear then append values to a drop down select menu. Problem is when the form is submitted the value sent for the drop down is null. script typetextjavascript document.readyfunction sel_year.changefunction var deptid this.val; .ajax url: model_search.php, type: post, data: Year:deptid, dataType: json, success:functionresponse var len response.length; sel_model.empty; for var i 0; ilen; i var id responseiID; var name responseimodel_name; sel_model.appendoption valueidnameoption; ; ; ; script Then the HTML form actionmenu.php methodPOST div classcontainer h1Auto populate dropdownh1 div iddiv_content divYear div select nameYear idsel_year option value0- Select -option option value19961996option option value19971997option option value19981998option select divModel div select namesel_model idsel_model option value1- Select Year First-option select div div form Submitting the form results in: Array Year 2001 sel_model null I just dont understand why the value is null.

Комментарии

Популярные сообщения из этого блога

Как преобразовать вертикальную запись в горизонтальную?

Skipping acquire of configured file 'contrib/binary-i386/Packages' as repository … doesn't support architecture 'i386'

How to delete a folder in remote Windows from Linux