[jQuery] What's the best way to pass parameters through jQuery's ajax?
Right now, I'm using jQuery's ajax like the following:
function hello_world(param1, param2, param3, param4)
{
$.ajax(
{
type: 'POST',
url: 'foo.php',
dataType: 'html',
data: 'param1=' + param1 + '¶m2=' + param2 + '¶m3=' +
param3 + '¶m4=' + param4,
success: function(data)
{
}
});
}
In foo.php, I retrieve the parameters like:
$_POST['param1], ...
Is there a more elegant way to pass the parameters on the javascript
side?