如何处理jQuery ajax URL更改?

时间:2022-11-29 13:58:10

I have a web service at:

我有一个网络服务:

/localhost/portal/ WebServices/InformationNoticeUtility.asmx/InformationNoticesGet

when user goes to another page for example:

当用户转到另一个页面时,例如:

/localhost/portal/Reporting/

and tries to call this web service using jquery Ajax, it will fail because jquery replaces the url of the web service to the following url:

并尝试使用jquery Ajax调用此Web服务,它将失败,因为jquery将Web服务的url替换为以下url:

/localhost/portal/Reporting/ WebServices/InformationNoticeUtility.asmx/InformationNoticesGet

Is there any way I could pass in an object to overcome this error?

有什么方法可以传递一个对象来克服这个错误吗?

1 个解决方案

#1


0  

Seeing your code would help, but do you have a <base> tag on your page? If so, that may be causing your unexpected results. If not, you may actually desire that behavior and might want to try it.

查看代码会有所帮助,但您的页面上是否有标记?如果是这样,那可能会导致意外结果。如果没有,您可能实际上希望这种行为并且可能想要尝试它。

See here for a good discussion of caveats.

请参阅此处以获得有关警告的详细讨论。

#1


0  

Seeing your code would help, but do you have a <base> tag on your page? If so, that may be causing your unexpected results. If not, you may actually desire that behavior and might want to try it.

查看代码会有所帮助,但您的页面上是否有标记?如果是这样,那可能会导致意外结果。如果没有,您可能实际上希望这种行为并且可能想要尝试它。

See here for a good discussion of caveats.

请参阅此处以获得有关警告的详细讨论。