[Dojo-interest] Modifying Ajax post request data using dojo/notify api

Asim Ishaq asim709 at gmail.com
Fri Jun 13 15:44:21 EDT 2014


I am trying to attach a Form data variable to Ajax Post Request using
DOJO/NOTIFY. For example: there is a form which sends an item *a = 10* to
the server. *Using dojo/notify (send)* I attach another variable*b=5* with
the ajax post request *but the problem is that it does not work and only
a=10 is sent to server*. Following is my code:

require(["dojo/request", "dojo/request/notify"], function (Request, Notify) {

    //Called before sending Ajax Request
    Notify("send", function (request) {
        /*
          At this point I want to add another form data item before
          it is sent to Server.Example b = 5. The following is the
          way to do it but It does not seem to work:
        */

        request.options.data += "&b=5";
        //I also tries the following but it also not working:
        //request.options.data.b = "5";
    });

    Request.post("http://jsfiddle.net/",{
        data:{a:10}
    });});

JSFIDDLE: http://jsfiddle.net/TEMA2/1/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20140614/11224e24/attachment.htm 


More information about the Dojo-interest mailing list