jQuery AJAX to call Java method

前端 未结 2 2018
不思量自难忘°
不思量自难忘° 2021-01-27 06:20

Using jQuery AJAX, can we call a specific JAVA method (e.g. From an Action class)

The returned data from that Java method would be used to fill in some HTML code.

<
2条回答
  •  一生所求
    2021-01-27 07:10

    It's not as transparent as with DWR--DWR handles making JavaScript look like Java. With jQuery you'll get JSON (or just HTML if/when it's easier that way). It's still pretty straight-forward, though. You'd send the Ajax request to a URL, rather than having it look like a local method call.

    I'm not sure what you mean by "multiple data points in HTML" -- you get back whatever data you get back, and you can do with it whatever you want. If the response has all the data you need, then you wouldn't need to make multiple requests.

提交回复
热议问题