Question

I have made web service in php, which sends email to seller with information which is sent in parameters. If we are sending those information in GET, the web service works well. But if we send that information in POST, the web service (php script) shows nothing.

Here is url of that web service :

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.

Currently i am just showing param passed using

print_r($_REQUEST);

Well this is working fine because i am sending those paramerters in GET but I am trying to send those parameters in POST using chrome extension "Simple REST client", I am getting nothing.

I guess, I need to set headers in my script, but not sure about that. Or when calling that web service we need to set any thing header in request.

Here is how request via POST is send :

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);
                }
            });

Any help would be highly appreciated..

Thanks.. Anjum

Was it helpful?

Solution

Try putting the jsonData in params as follows :

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
}
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top