Reputation: 645
I have built a website which working fine without any javascript (I have even avoided using link button). Now i want to use javascript using jquery and json for richer interactive website. Can somebody show me with example of a submit button which work with jquery and json (partial postback for submitting data to server) when javascript is enabled. when javascript is disabled it should do normal server side posting.
Upvotes: 0
Views: 184
Reputation: 66641
There many way to do this "double action", I can give you one idea. First you make a handler that make your work and execute your commands. Then you make the simple easy think to call this command via link and url parameters.
eg:
<a class="AjaxCallsClass" href="dothiswork.ashx?WorkID=23">Show This</a>
Now at the same time you use jQuery to place on your links javascript to capture the onclick
So if the user have enable the javascript, you add extra code that use ajax to call the same command, get the results and print it on page.
So with or with out javascript the command is the same, and you only need to manipulate a little the way the output will be.
I hope that this helps.
Upvotes: 1