[eluser]jdfwarrior[/eluser]
I have it working with a local install of 1.5.4. Exact same code.. I think. Check code below. This is a base install of CodeIgniter. Nothing new added except the js file to make it run. I just modified the welcome_message.php view file and the welcome.php controller.
This is the temp.js I made for jQuery:
Code:
$(document).ready(function() {
$("#btn").click(function() {
alert("button clicked");
$.post("welcome/test", { user: $("#user").val(), pass: $("#pass").val() }, function(data){
alert("returned: " + data)
});
});
});
Welcome.php controller modified to add the "test" function that jQuery would be submitting to:
Code:
class Welcome extends Controller {
function Welcome(){ parent::Controller(); }
function index() { $this->load->view('welcome_message'); }
function test() {
$user = $this->input->post('user');
$pass = $this->input->post('pass');
echo "I got {$user} and {$pass}";
}
}
And once again, this HTML added to the end of the welcome_message.php view
Code:
User<br />
<input type="text" name="user" id="user" /><br />
Password<br />
<input type="password" name="pass" id="pass" /><br />
<input type="button" id="btn" name="btn" value="submit" />
It works. So if something is not working on your end, its something to do with your code because the functionality is there.