Thinkphp--ajax 's URL problem?

How does the URL in

XmlHttpRequest.open () write the code in the
controller as follows:
public function check () {

    $name = array("eq",I("get.name"));
    $user = D("User");
    $result = $user->field("name")->where($name)->find();
    if($result>0){
        return true;
    }else{
        return false;
    }
}

is it written like this in URL: {U: ("Home/User/check")}?

Mar.22,2021

if you are in a template file, you can use {: U ('.')}
if you are in a separate js file, you can consider putting url into the attributes of an element. Take out url from js and use


you can use U method to generate a link in a js variable and put it in the header head of the page, so you can use

in all pages.
Menu