这是我的代码......
var o_color ='<?php echo $o_color;?>'; //i have also tried urlencode($o_color)
var o_color1 ='';
此代码工作正常....
window.location.href = site+"name="+$(this).attr('id')+'&o_color='+o_color;
但此代码不起作用....
window.location.href = site+"name="+$(this).attr('id')+'&o_color='+o_color+'&o_color1='+o_color1;
Note:o_color is in hexa code #e34343;
我在控制台日志上收到一条jquery错误消息......
Uncaught Error: Syntax error, unrecognized expression: a[rel=123123&o_color1=]
答案 0 :(得分:2)
尝试从"o_color"
window.location.href = site+"name="+$(this).attr('id')+'&o_color='+ o_color +'&o_color1='+o_color1;
记录你必须: -
<script>
var site='http://localhost/new/';
var o_color = '#e34343';
var o_color1 = '';
window.location.href = site+'name=dfg&o_color='+o_color+'&o_color1='+o_color1;
</script>
答案 1 :(得分:2)
试
window.location.href = site+"name="+$(this).attr('id')+"&o_color="+o_color+"&o_color1="+o_color1;
根据你
<script>
var site='http://localhost/new/';
var o_color = '#e34343';
var o_color1 = '';
window.location.href = site+'name=dfg&o_color='+o_color+'&o_color1='+o_color1;
</script>