![]() |
|
[Help] [JavaScript] How to submit a POST param named 'submit' ?? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5) +---- Thread: [Help] [JavaScript] How to submit a POST param named 'submit' ?? (/showthread.php?tid=3227350) |
[JavaScript] How to submit a POST param named 'submit' ?? - Traitor-Panda - Feb 2, 2013 Basically I need to (through javascript) create a post request with a parameter named "submit" (without quotes). I've previously used a simple html form to generate post requests without any problems but it won't let me do a post request with a parameter named submit - obviously because it collides with the action called submit. I've been trying to figure out how to do this for a few hours now but with no luck. Anyone got a bright idea? * - CarrotMilk - Feb 2, 2013 Erm, well, can't you just add this to the form? Code <input type="submit" name="submit"/>OR in your JS query string: Code var post = 'post=true';* - Traitor-Panda - Feb 2, 2013 (Feb 2, 2013 05:10 PM)CarrotMilk Wrote: Erm, well, can't you just add this to the form? That's the problem. That's what I have now and it messes up as explained in: http://www.spiration.co.uk/post/1232/Submit-is-not-a-function However the parameter needs to be named "submit" * - CarrotMilk - Feb 2, 2013 So what if the parameter needs to be named submit? It's no big deal, lol. There are a TON of ways to get around this. Show code, please. * - Traitor-Panda - Feb 2, 2013 This is essentially my code (note that I placed in google.com because I can't reveal the real URL). So essentially I want to post the parameter named submit. How would I fix this? Code <script>* - CarrotMilk - Feb 2, 2013 I don't see why you're doing that. But then again, it's almost 2am. Why don't you just use a regular HTML form? * - Traitor-Panda - Feb 2, 2013 (Feb 2, 2013 06:37 PM)CarrotMilk Wrote: I don't see why you're doing that. But then again, it's almost 2am. Why don't you just use a regular HTML form? It is a html form - it's just being generated by javascript. The function allows me to make custom post requests at will. However it really has nothing to do with my original question - how would I post a parameter named "submit" ? You said there'd be a TON of ways? * - CarrotMilk - Feb 2, 2013 (Feb 2, 2013 06:43 PM)Traitor-Panda Wrote: It is a html form - it's just being generated by javascript. Yes, a ton of ways to get around it. It's just incredibly weird the way you've done it, lol. Just failing to see the point; custom POST requests..? If that's the case, yuno AJAX? Or just HTML hidden fields (like you are doing in the JS)? * - Traitor-Panda - Feb 3, 2013 (Feb 2, 2013 06:44 PM)CarrotMilk Wrote: Yes, a ton of ways to get around it. It's just incredibly weird the way you've done it, lol. Just failing to see the point; custom POST requests..? If that's the case, yuno AJAX? Or just HTML hidden fields (like you are doing in the JS)? I can't use AJAX since I need to use the users credentials and not the servers credentials. With javascript the users IP&cookies are being used while with AJAX they're not. Trust me the only way seems to be the way I'm doing it - I just need to know how to handle the "submit" issue. EDIT: Got it fixed now. As CarrotMilk suggested I created a submit button through html and merely invoked a click on the page load. Works brilliantly. |