Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在yii2的select2小部件的从属文本框中找不到404_Yii2 - Fatal编程技术网

在yii2的select2小部件的从属文本框中找不到404

在yii2的select2小部件的从属文本框中找不到404,yii2,Yii2,当选择dropdownlist(customerid)时,我尝试自动填充文本框(Customername、CustomerAddress、customerMobileno)。成功选择了客户Id,但在获取控制器操作时出现问题。我得到了404错误。我想说的是,我使用的是这里告诉我的prettyurl- 在firebug中,我得到以下错误- GET http://localhost:8080/amitopticals/debug/default/toolbar?tag=57a4b1623a201 2

当选择dropdownlist(customerid)时,我尝试自动填充文本框(Customername、CustomerAddress、customerMobileno)。成功选择了客户Id,但在获取控制器操作时出现问题。我得到了404错误。我想说的是,我使用的是这里告诉我的prettyurl-

在firebug中,我得到以下错误-

GET http://localhost:8080/amitopticals/debug/default/toolbar?tag=57a4b1623a201

200 OK
        90ms    
create (line 545)
GET http://localhost:8080/amitopticals/orders/orders/....php?r=orders/customer/get-for-customer&custid=2

404 Not Found
        10ms    
jquery.js (line 9175)
ParamsHeadersResponseHTMLCookies

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Object not found!</title>
<link rev="made" href="mailto:postmaster@localhost" />
<style type="text/css"><!--/*--><![CDATA[/*><!--*/ 
    body { color: #000000; background-color: #FFFFFF; }
    a:link { color: #0000CC; }
    p, address {margin-left: 3em;}
    span {font-size: smaller;}
/*]]>*/--></style>
</head>

<body>
<h1>Object not found!</h1>
<p>


    The requested URL was not found on this server.



    The link on the
    <a href="http://localhost:8080/amitopticals/orders/orders/create">referring
    page</a> seems to be wrong or outdated. Please inform the author of
    <a href="http://localhost:8080/amitopticals/orders/orders/create">that page</a>
    about the error.



</p>
<p>
If you think this is a server error, please contact
the <a href="mailto:postmaster@localhost">webmaster</a>.

</p>

<h2>Error 404</h2>
<address>
  <a href="/">localhost</a><br />
  <span>Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.12</span>
</address>
</body>
</html>

如果你使用了漂亮的url,你的结果url应该是

://localhost:8080/amitopticals/orders/customer/get-for-customer?custid=2
而不是生成消息头

://localhost:8080/amitopticals/orders/orders/....php?r=orders/customer/get-for-customer&custid=2
所以对你来说,得到美元而不是

 $.get('index.php?r=orders/customer/get-for-customer',{ custid : custid }, function(data){
    alert(data);
    ........
你应该使用

 $.get('customer/get-for-customer',{ custid : custid }, function(data){
    alert(data);

嗨,scaisEdge,控制器操作在CustomerController中。但是“客户/为客户获取”不起作用,“客户/为客户获取”也不起作用。然后我将控制器操作移动到OrdersController,并尝试“为客户获取”,结果成功了。但是我如何从其他控制器(在本例中是CustomerController)使用它?orders模块中有两个控制器-OrdersController和CustomerController。在CustomerController中,您可以使用Url::to(“[orders/get for customer]”);使用UrlHelpers,您必须添加
use yii\helpers\Url@Tanmay.这次进展顺利。。只花了一句话。。干得好,一天比一天好。谢谢你。:)
 $.get('index.php?r=orders/customer/get-for-customer',{ custid : custid }, function(data){
    alert(data);
    ........
 $.get('customer/get-for-customer',{ custid : custid }, function(data){
    alert(data);