Here is my code below that works, but passess only the first parameter. But I need two. I think JSON should be used for that purpose. I’ve tried, but still have no luck. Here is my working code that sends name. This function does NOT pass password
var name = $('#name').attr('value');//the value from input type name
var password = $('#password').attr('value');//the value from input type password
$.ajax({
type: "POST",
url: "index/success",
data: "name="+ name +"&password="+ password,
success: function(){
$('form#submit').hide(function(){$('div.success').fadeIn();});
}
});
From the other side I use method
$model->values ( $_POST );
so that
$model->name is defined and is what I actually sent.
But,
$model->password is empty.
P.S. Password should be crypted, I know that. That’s a simplified example just to ask about using JSON.
Try
and let jQuery worry about encoding that for the request.