Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/380.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
Javascript URL在jquery脚本处理时展开_Javascript_Jquery_Url_Laravel_Laravel 4 - Fatal编程技术网

Javascript URL在jquery脚本处理时展开

Javascript URL在jquery脚本处理时展开,javascript,jquery,url,laravel,laravel-4,Javascript,Jquery,Url,Laravel,Laravel 4,我有一个按钮可以将一些内容加载到DIV中: <button data-toggle="modal" data-target="#modal_toolbox" get-what="partial/answer_question/{{ $ae->item_id }}">get the answer</button> 问题: 按钮所在页面的url为 myapp.com/examplars/4 我通过jquery调用的URL给出: local.ERROR: 404 - E

我有一个按钮可以将一些内容加载到DIV中:

<button data-toggle="modal" data-target="#modal_toolbox" get-what="partial/answer_question/{{ $ae->item_id }}">get the answer</button>
问题: 按钮所在页面的url为 myapp.com/examplars/4

我通过jquery调用的URL给出:

local.ERROR: 404 - Exception @ /exemplars/partial/answer_question/91
在这种情况下,我通常的解决方案是: 我刚才在L-4应用程序中 {{URL::to}} 但它不能在这里应用

我的工作解决方案: 我只是把…/添加到

get-what="../partial/answer_question/{{ $ae->item_id }}"
我的问题: 我认为我的变通方法不是一个好的做法。 如何在上述解决方案中获得正确的URL?或者我如何才能以更好/适当的方式获得预期的结果


Thx

由于当前页面位于/exemplars文件夹中,因此任何相对地址都将使用它作为源。如果要使用web根作为源,可以使用虚拟地址,即以斜杠开头以指定根:

get-what="/partial/answer_question/{{ $ae->item_id }}"
get-what="/partial/answer_question/{{ $ae->item_id }}"