【问题标题】:Unable to get values in POST php web serivce无法在 POST php Web 服务中获取值
【发布时间】:2014-05-09 19:49:30
【问题描述】:

我在 php 中创建了 web 服务,它向卖家发送电子邮件,其中包含以参数发送的信息。如果我们在 GET 中发送这些信息,则 Web 服务运行良好。但是,如果我们在 POST 中发送该信息,则 Web 服务(php 脚本)什么也不会显示。

这是该网络服务的网址:

http://demo1.zenithtechnosol.net/carsGuide/contactSeller.php?seller_id=0&name=Anjum&email=abc@ccc.com&mobile=00923344239490&area=Dubai&message=This%20is%20test%20message.

目前我只是显示使用传递的参数

print_r($_REQUEST);

这很好,因为我在 GET 中发送这些参数,但我正在尝试使用 chrome 扩展“简单 REST 客户端”在 POST 中发送这些参数,但我什么也没得到。

我想,我需要在我的脚本中设置标题,但不确定。或者在调用该网络服务时,我们需要在请求中设置任何事物标头。

这是通过 POST 发送请求的方式:

Ext.Ajax.request({
                url: this.getBaseUrl() + webServiceUrl,
                timeout: 240000,
                method: httpMethod,
                disableCaching: false,
                useDefaultXhrHeader: false,
                jsonData : {
             "seller_id":seller_id,
             "name":name,
             "email":email,
             "mobile":mobile,
             "area":area,
             "message":message              },
                scope: me,
                success: function(response) {
                 Ext.Viewport.unmask();
                    successCallBack(response);
                },
                failure: function(response) {
                 Ext.Viewport.unmask();
                   failureCallback(response);
                }
            });

任何帮助将不胜感激..

谢谢.. 安居姆

【问题讨论】:

    标签: php ajax web-services extjs


    【解决方案1】:

    尝试将 jsonData 放入 params 中,如下所示:

    Ext.Ajax.request({
                url: this.getBaseUrl() + webServiceUrl,
                timeout: 240000,
                method: httpMethod,
                disableCaching: false,
                useDefaultXhrHeader: false,
                params: {
                  jsonData : {
                       "seller_id":seller_id,
                       "name":name,
                       "email":email,
                       "mobile":mobile,
                       "area":area,
                       "message":message              },
                }},
                success: function(response){
                var text = response.responseText;
                // process server response here
    }
    });
    

    【讨论】:

    • 像这样发送参数,它可以工作:params: { "seller_id":seller_id, "name":name, "email":email, "mobile":mobile, "area":area, "消息“:消息}
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多