I think going on json way is much better

function hello_world(param1, param2, param3, param4)
{
    $.ajax(
    {
        type: 'POST',
        url: 'foo.php',
        dataType: 'html',
        data: {param1 : param1_value, para2 : param2_value, param3 :
param3_value},
        success: function(data)
        {
        }
    });

}

On Apr 24, 7:30 pm, Thierry <lamthie...@gmail.com> wrote:
> 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 + '&param2=' + param2 + '&param3=' +
> param3 + '&param4=' + 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?

Reply via email to