【问题标题】:Giving 2 parameters to remote_function using 'with'使用 'with' 为 remote_function 提供 2 个参数
【发布时间】:2011-03-04 23:04:39
【问题描述】:

我正在尝试在 remote_function 中提供几个参数,如下所示:

<?php 
echo remote_function(array( 'update' => 'test',
                           'url' => 'conges/verifdate',
                           'with' => "'date_deb=' + $('date_debut').value"
                    ));
?>

此代码有效(在我的action.class 中我可以获取参数)。

但是当我尝试给第二个参数时,它不起作用:

<?php
    echo remote_function(array( 'update' => 'test',
                           'url' => 'conges/verifdate',
                           'with' => "'date_deb=' + $('date_debut').value"."'+&date_fin=' + $('date_fin')"
                    ))
?>

我做错了什么?

【问题讨论】:

    标签: javascript ajax symfony1


    【解决方案1】:

    我是这样做的:

    'url' => 'conges/verifdate?vars=serialize(array("var1" => 1, "var2" => 2))'
    

    在您的远程操作中:

    $vars = unserialize($request->getParameter('vars'));
    

    【讨论】:

    猜你喜欢
    • 2022-12-17
    • 1970-01-01
    • 2020-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多