CodeIgniter Forums
[Help] with <select> auto reload - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: [Help] with <select> auto reload (/thread-52976.html)

Pages: 1 2


[Help] with <select> auto reload - El Forum - 07-05-2012

[eluser]marjune[/eluser]
yeah ajax its perfect


[Help] with <select> auto reload - El Forum - 07-05-2012

[eluser]C_Line[/eluser]
Code:
<td>
[removed][removed]
[removed]
$(document).ready(function()
{
$(".propinsi").change(function()
{
var id=$(this).val();

$.ajax
({
type: "POST",
url: "&lt;?php echo base_url();?&gt;index.php/main/sel_kota/",
data: id,
cache: false,
success: function(html)
{
$(".kota_user").html(html);
}
});

});

});
[removed]

<h1><center>Registrasi</center></h1>
&lt;form name="form1" method="post" action="&lt;?php echo $_SERVER['PHP_SELF'];?&gt;"&gt;
<table align="center">
<tr><td>Nama : </td><td>&lt;input type="text" id="nama" name="nama" value="&lt;?php echo $_SESSION['names']; ?&gt;"&gt;&lt;/td></tr>
<tr><td>Password : </td><td>&lt;input type="password" id="pass" name="pass" value="&lt;?php echo $_SESSION['password']; ?&gt;"&gt;&lt;/td></tr>
<tr><td>Konfirmasi Password : </td><td>&lt;input type="password" id="kpass" name="kpass" value="&lt;?php echo $_SESSION['confirm_pass']; ?&gt;"&gt;&lt;/td></tr>
<tr><td>Propinsi</td><td>
<select name="propinsi" class="propinsi">
&lt;?php
foreach($prop as $kue)
{
?&gt;
<option value="&lt;?php echo $kue-&gt;Propinsi; ?&gt;">&lt;?php echo $kue->Propinsi; ?&gt;</option>
&lt;?php
}
?&gt;
</select>
</td></tr>

<tr><td>Kota</td><td>
<select name="kota_user" class="kota_user">
<option selected="selected">--Select City--</option>
</select>
</td></tr>

why can't load?
anyone can explain me how jquery above work?
like $(document).ready(function()
thx