I have a table with some items. I select one and when i click a button i want to send its id in the server side and based on that id to create some excel file. To send the id from the client should i use a classic post(create a form, assign to id a hidden, submit it and destroy it) or should i use $.post from jquery(or any other ajax)
When to use each?
I have a table with some items. I select one and when i click
Share
First of all, your application should be able to work even for people who don’t have Javascript support enabled in their browser — which means your application should work without any Javascript being required ; which means your should implement the form / hidden field / post method.
Then, when this work, you can enhance user-experience with a bit of Ajax : instead of using the form you created, just send an Ajax request ; the goal being to not do a full page-load, and have something that’s more user-friendly.
But note that, if the user disable’s Javascript, your application should fall-back to the first solution.
To make things short :