Best method to submit content with jQuery
Maybe you can help me understand some pretty basic stuff here. I am new to jQuery and web in general (though I have a lot of winforms / win32 experience). I have a website that runs on Google App Engine and uses Django and jQuery. The website is used to order a service. It has three forms:
- A form in which you describe yourself (e.g you input name, address and so forth) you click next and then the following form appears:
- A form in which you input the info of the 开发者_如何学运维service you want, such as service name and date. this form needs to display the data you entered in the previous form (form 1) in case you forgot something. you click next, and then the system needs to save all the data you wrote so far, and process your request for a service (this is done at the server side). this form is now displayed:
- A form which shows a summary of your service request (and allows you to do other things such as sending the info to other people and so forth).
How would you transfer the data from form 1 to form 2 and then to the server? POST? is this safe? how will you do this in code? is there a way to transfer JS objects?
Make one form in one page and using JavaScript display sections of the form as needed. As far as submitting form values is concerned, you can either submit directly to script via form attribute action="...script url..."
, or if you choose to employ AJAX you can use JavaScript or use jQuery's $.post()
.
This is a pretty open ended question.
So I'll start with one of the unnumbered questions first: "Is this safe".
The quick answer is probably no.
Here's some examples of how to answer that question:
Example:
I want to make a javascript app that can collect data. I will hold all data in this javascript object.
1: Is this safe. 2: No it's not, it can be manipulated by anyone with a browser.
Example 2:
I will just transmit that stuff via GET or POST to my server and then mess with it there.
1: Is this safe. 2: No it's not, I don't really get how stuff is stored and my ignorance will cause my data to get stolen.
Example 3:
I totally understand my server and my initial page.
1: Is this safe. 2: No it's not, unless all of my data is transmitted over SSL/TSL it is widely available to nefarious uses.
Example 4:
I have an SSL service and I understand everything about my data transmission. I need to store my information to retrieve it later.
1: Is this safe. 2: No it's not. I am using Google App engine so I'm just a trusting individual OR I'm using S3 and I trust them. or I'm using a sql server with whatever os and I trust those vendors, etc.
Example 5:
I feel ignorant that I just blindly trust my vendor.
1: Is this safe? 2: No it's not. (Obviously)
All that said you're using a Google App Engine backend so there's a ton of help on this.
Sorry it's my birthday and your question caused me to wax philosophically while I waste the day at work.
But remember, the prudent answer to "Is it safe" is always "No"
精彩评论