I needed to pass multiple values with a select option. It’s easily accomplished by setting the value to a JSON string
1 2 3 | while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) { echo "< option value = " . json_encode($row) . " >" . $row['STRTYPENAME'] . "</ option >\n"; } |
And using JSON.parse to pull out the key of the value you need:
1 2 3 4 5 6 | jQuery( "#selectDivSetType" ).change( function () { var strTemplateObject = $( '#selectDivSetType' ).val(); var jsonTemplateObject = JSON.parse( strTemplateObject ); var strTemplateURI = './templates/' + jsonTemplateObject.STRTEMPLATENAME; $( '#templateURI' ).attr( "href" , strTemplateURI); }); |