I just learned how to make HTTP requests via POST to a URL. Now, the website that I need to make a POST request to sends you the page without the form and when you click a button it loads the form with JavaScript.
I tried to find the form on the page, but it does not exist.
Is it only possible to fill the form in the main page after that the form has been loaded with JavaScript? How can I fill out the form?
I tried to use the normal POST method, but not working.
Related
I want to submit this https://rtovehicle.info/rcstatus website page with my input using my website portal
For user fill out the form on my website and my website form to this site and get a response and filter it and show it to my site.
Help me
My site is finb.app I want to submit the request to https://rtovehicle.info/rcstatus this and get response from https://rtovehicle.info/rcstatus and show it on my site. Because this site is using APIs and I don't have accesss that is why I want to use this site to access RC details for users. I have used Iframe, and curl.
Page A is the parent. From page A, the user clicks on a link and a new page B opens. I do not own page B. Then there, there is some kind of registration form for the user to complete. I need to know in page A that the form on B is submitted correctly when it happens (inject JS?).
I will handle the JS to determine if the form is completed or not. What I'm asking if it is possible what I am looking for, to send back the info to page. I would do this using an iframe, all within the same page but I am getting mixed content errors as page B is in http (I need my page A to be in https).
Normally this is not possible, but sometimes forms have some kind of callback, for instance forms from payment providers. They allow you to send your customer to their payment page, and they redirect them back to a callback page after the payment is done. Hopefully PageB supports such a thing, otherwise, you're in trouble.
One possible solution, if the form isn't very complex, and doesn't have much scripting, and doesn't require logon or other session or cookie related stuff, you might use file_get_contents or curl to get the form, modify it a little to post the changes to another script of yours, and then, from the server, post the form data to originating server. That way, you capture the entire form and everything the user submits is submitted through your server, giving you all the information you need.
Of course this is not easily possible with every form, so you'll have to try if it works for this one.
I have a poll system provided by an outsourced application.
After users choose one of the radio button's choices and click a Submit button, my JavaScripts will redirect them to a specific url (ex. http://www.poll.com/answer). This is a must for posting data to that outsourced application, so this url must be processed.
But what if I don't want to show users this page, but redirect them to a finish page, What should I do with this condition in JavaScripts?
It looks like this.
..When click Submit..
Hidden Run URL for posting data to an outsourced application. (MUST DO)
Redirect to MY finish page.
One possible solution, depending on if you are doing server side programming, is to submit the data in the code behind.
After submitting the data to your code that handles the form submission. Your code passes the values to the third party instead of having the third party be the form submission location. Since you are handling the form submission with your code, you are free to redirect the user as you please.
If you aren't doing server side programming, I'm not sure if there is a way to hide the form submission location from the user.
I'm going to make a few assumptions to clarify my understanding.
You have a web page which contains radio buttons
When a user selects a radio button and submits, you want to post this answer to an external url
Once the data is posted to the external link, you want to show a success page to the user.
You have two options:
Server Side
When a user submits a radio button selection, post the data to a url on your own server. Like a simple form submit
On the server, take the user's input and post it to the target URL.
Return a success page to the user
As far as the user is concerned, he never leaves your site.
Client Side - Ajax
When a user submits a radio selection, trap the submit event, make an ajax call to the target url, posting the user's selection
When the ajax call returns success, ie the data has been posted properly, redirect the user to a success page url, hosted on your own server
Let me know if you need further clarification.
Is auto post back in ASP.net and AJAX are the same??? I want to send data to server and store that data in XML file without refreshing the page. I dont want to use ajax.. If there is any other way to do this with plain javascript then do let me know... thanks in advance...
Is auto post back in ASP.net and AJAX are the same???
Not from a users perspective. When doing a postback, the user will see his entire page getting refreshed. When using AJAX, the user will not see his page get refreshed
I want to send data to server and store that data in XML file without
refreshing the page. I dont want to use ajax.. If there is any other way
to do this with plain javascript
If you want to interact with the server without refreshing the page, you have to use AJAX.
Note: You may be confusing AJAX with the various AJAX controls / libraries like AjaxControlToolKit etc. If that is the case, then you can definitely use AJAX without using any of the libraries / controls. That is done by using the XMLHTTPRequest and XMLHTTPResponse objects directly via Javascript. However, that in itself is AJAX. Sample code of how to do it can be seen in this page
So, atleast as far as i know, you need to use AJAX to go to the server without appearing to the user that your page has gotten refreshed.
as InSane said PostBack is quite different in AJAX and asp.net. AJAX mostly use Partial postback using XMLHTTPRequest Objects while full page postback sends complete Page's data to server resulting in complete page recycle.
For Your second question.. if you don't want to postback and still want to send some data to server there is only one way to do this by AJAX. AJAX in javascript is quite obscure i'll prefer using some javascript library like JQuery. Here is a link that shows how to call WebMethod on an ASPX page from JQuery.
http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/
Hope this will help.
Regards.
Sorry if this is a newbie question, but I've spent several hours on this without success. I've got a PHP script that generates some text I want to submit to an external Web site's form. Is it possible to use JavaScript code on one page to open a page on another server and then add text to that second page's html form from the code on the first page?
No. Check out this wikipedia article about same origin policy:
http://en.wikipedia.org/wiki/Same_origin_policy
EDIT: One thing you can do is submit form data from one site to another. So for example if there is a sign in form on a page. You can't use javascript to populate that form but you could use your page to do a form post from your site to the action of the form on their site. Just make sure that the method(get,post) is the same and the field names are the same. Though keep in mind that a lot of sites do check to make sure that forms are submitted from their own sites but it is possible to try something like this.