Welcome Guest, Not a member yet? Register   Sign In
Ajax form submit best pratices?
#1

[eluser]Krzemo[/eluser]
Hi,

Im working on a form contents of which are to be saved into DB via Ajax request.
One of the fields is textarea and might contain relatively long text along with some characters that supposingly might not be allowed in URI by default and characters like lf or rf.
Ajax request will look more less like that:
http://localhost/applicaiton/controller/...eld2value/ ...

Is it generally acceptable aproach? Or should (must) work on different solution?

Thnx
#2

[eluser]davidbehler[/eluser]
Have a look at my Shoutbox.
There I use AJAX to submit a form using the post method.
#3

[eluser]Krzemo[/eluser]
Thnx.
I just got an idea - encoding utf8 string to hex and reversing it back in controller would solve my problem...
#4

[eluser]elvix[/eluser]
you should use post to pass your data, not get. that's what waldmeister was getting at above.
#5

[eluser]Nick Husher[/eluser]
Even if you manage to encode your form data as a URI-safe data string, you're still going to run into the character limit pretty quickly for a form of any great size. That limit is around 2000 characters in IE, and Apache has an upper limit of around 4000 characters. The other browsers don't seem to care, but generally you want to avoid super-long URLs for the sake of sanity.

To give you an idea of how big 2000 characters is, that's less than half the size of the maximum supported post size for this forum. POST, on the other hand, has no upper limit (AFAIK).
#6

[eluser]Krzemo[/eluser]
Thnx - im getting it working proper way now I guess Smile




Theme © iAndrew 2016 - Forum software by © MyBB