Is there a way in Ajax to not send variables in the url BUT using hidden variables?
usually we create a url with parameters and values and send it via ajax to not loading page.
Is there a way to not send variables in the url BUT using hidden variables??
I have a problem in my website that doesn't permit me to send variable in url, so the ajax is not working anymore:
the problem is when i choose a language and the url become like this:
http//..../en/page -->here it is impossible to add variables to the url and success
is there a way to solve this issue??
hope i do get help :(
Best regards,
zanzo
zanzo
Junior Poster in Training
58 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
> here it is impossible to add variables to the url and success
Why is it impossible?
What prevents you from creating a URL of the form http://somesite.net/en/page?name=somename&age=someage ?
Anyways, if the operation involves POSTing data rather than GETting it, consider using POST requests rather than GET ones when making asynchronous calls.
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
Because, I'm using writing rule, i can't add "?name=somename&age=someage" to url!!
maybe if i add this parameters to the writing i can solve the problem??
/en/somename/someage/page!!
zanzo
Junior Poster in Training
58 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
You have two options:
- Either come up with intelligent URL rewriting rules so that situation as mentioned above can be effortlessly handled. I am sure it can be, it just requires a bit of tact with regular expressions, that's all.
- Use the POST method when making asynchronous calls; this isn't as such recommended if you are trying to get some query results.
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
I think I will try the first option, as I'm using ajax and can't use post method!!
zanzo
Junior Poster in Training
58 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
> I'm using ajax and can't use post method!!
Technically, you *can* use the POST method when using Ajax, there is nothing which prevents you from doing so; whether it pertains to your application/business is another question.
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
I tried to put "post" instead of "get" in ajax but still it sends the parameters in the url!! :S
zanzo
Junior Poster in Training
58 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0
Trial and error has little place in programming; get a good book or a solid online reference (MSDN or Mozilla tutorials) and learn more about Ajax.
~s.o.s~
Failure as a human
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
Thanks for ur advices, I solved the bug ;)
zanzo
Junior Poster in Training
58 posts since Feb 2008
Reputation Points: 10
Solved Threads: 0