jquery ajax get return value

后端 未结 7 1546
不知归路
不知归路 2021-01-21 04:22

i want to get the \'printed value\' of html pages.

i tried below query, but showGetResult() just return \'null value\'

but my apache server logs printed i access

7条回答
  •  攒了一身酷
    2021-01-21 04:55

    This is the way AJAX works (asynchronously, like the name suggests). The showGetResult function returns before the AJAX call completes. showGetResult will therefore simply return null since that's what you've assigned to result.

    Move any code that depends on the result of the AJAX call inside the success callback. Alternatively, you could make the call synchronous, but that's not usually what you want.

提交回复
热议问题