Any help making a Ajax plugin with Put and headers

Get help using Construct 2

Post » Tue Apr 23, 2013 1:06 pm

Hi, if anyone can help me to make a ajax plug (working off default plugin) to do PUT and GET request with custom headers and header responses

http://www.scirra.com/forum/topic66799_post410385.html#410385
B
24
S
11
G
5
Posts: 140
Reputation: 5,004

Post » Tue Apr 23, 2013 1:37 pm

Just a quick response, im in a hurry, so sorry if this is just pile of crap;

Runtime.js, around line 149 there's a workaround for cocoonjs:

               if (method_ === "POST" && data_)
               {
                    if (request["setRequestHeader"])
                    {
                         request["setRequestHeader"]("Content-Type", "application/x-www-form-urlencoded");
                         request["setRequestHeader"]("Content-Length", data_.length);
                    }
                         
                    request.send(data_);
               }
               else
                    request.send();



Could you use this snippet, make a varible like this.myHeader which you can set, and then replace the "setRequestHeader" with this.myHeader (and other stuff you need), and in construct before making the ajax call set this.myHeader with an action, and then make the call.


"Need to have something working by end of day :(" -> Ahh, the good 'ole deadlines :D

Cheers!
Be nice until it's time to not be nice
B
36
S
9
G
9
Posts: 293
Reputation: 6,652

Post » Tue Apr 23, 2013 2:48 pm

I tried that but wasn't sure if it was being used in normal browsers, also my normal ajax stops working. I will upload what i have done thus far
B
24
S
11
G
5
Posts: 140
Reputation: 5,004


Return to How do I....?

Who is online

Users browsing this forum: GSquadron and 25 guests