0

我已经建立了一个网站,它在没有任何 javascript 的情况下运行良好(我什至避免使用链接按钮)。现在我想使用 javascript 使用 jquery 和 json 来获得更丰富的交互式网站。当启用javascript时,有人可以向我展示一个与jquery和json一起使用的提交按钮的示例(用于向服务器提交数据的部分回发)。当 javascript 被禁用时,它应该进行正常的服务器端发布。

4

1 回答 1

1

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.

于 2012-02-10T05:18:12.910 回答