Search Results

Search found 1 results on 1 pages for 'user3766078'.

Page 1/1 | 1 

  • How can I pass select field ID and its value to ajax without having any form?

    - by user3766078
    I have a select field which has ID name as 'region_code' well as its value. And I want pass ID in ajax. As you can see below, the input field is not included in any form. It has a value and the ID Is it possible to get value in ajax as shown below? echo '<select id="region_code" onchange="show_region_code();">'; $result = mysql_query("SELECT region_code, region_name FROM list_region"); while($rows = mysql_fetch_array($result)) { echo "<option value=\"$rows[0]\">".$rows["1"].'</option>'; } echo '</select>'; My ajax function as below function show_region_code() { var region_code = $("#region_code").val(); $.ajax ({ type: "POST", url: "show_region_code.php", data: { region_code1: region_code }, success: function(data) { $("#region_code").html(data); } }); }

    Read the article

1