简体   繁体   English

如何在 SAP AJAX Webapp 中处理带参数的 URL?

[英]How to handle URL with parameters in a SAP AJAX Webapp?

I'm writing a Wordpress/AJAX based SAP web application, and I have a question about URL handling.我正在编写一个基于 Wordpress/AJAX 的 SAP Web 应用程序,我有一个关于 URL 处理的问题。

My application (roughly) looks like this:我的应用程序(大致)如下所示:

  1. There is an index.php file which basically contains a page container and the client-side code to handle ajax calls.有一个index.php文件,它基本上包含一个页面容器和用于处理 ajax 调用的客户端代码。
  2. The client-side code is responsible for switching the pages according to user clicks.客户端代码负责根据用户点击切换页面。 It does that by calling the registered action, which is mapped to a server-side function that returns the html for that page.它通过调用已注册的动作来实现这一点,该动作被映射到一个服务器端函数,该函数返回该页面的 html。 (So there is a function named get_about_page() that prints/returns the HTML of the requested page) (所以有一个名为get_about_page()的函数可以打印/返回请求页面的HTML

The problem with this setup is handling URLs.此设置的问题在于处理 URL。
The question at hand is how do I handle requests to URLs like http://domain.com/about , for example?手头的问题是如何处理对诸如http://domain.com/about URL 的请求?

Had I had an about.php page, I could add a rewrite rule to direct all requests there.如果我有一个about.php页面,我可以添加一个重写规则来将所有请求定向到那里。
I could also, theoretically, parse the URL on the client-side, and decide which ajax call to fire, but that seems like a bad idea.理论上,我也可以在客户端解析 URL,并决定触发哪个 ajax 调用,但这似乎是个坏主意。

使用预定义 wordpress api,它可以帮助你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM