Home >Backend Development >PHP Tutorial >jquery变量赋值问题

jquery变量赋值问题

WBOY
WBOYOriginal
2016-06-23 13:42:201143browse

jquery变量赋值问题
$(function() {
        $('#dosearch').click(function() {
            var id = $('#search').val();
            window.location.href = '{{ URL::route('admin.show',array('id'=>+id))}}';
        });
    });
jquery获取到了值,赋值到变量id里,怎样把这个变量放到array('id'=>+id)这个地方呢?+id不对


回复讨论(解决方案)

看看 {{ URL::route('admin.show',array('id'=>+id))}} 在 html 中变成了什么

这个url 是你php中路由的写法吧。

有一点 可以 肯定  你的 写法 就是错的  外面请用双引号

”{{ URL::route('admin.show',array('id'=>+id))}}“


其次  这貌似是php里调用某个方法,不知道 你为什么写到js里了!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php PHP_SAPINext article:php正则替换