我有一个jQuery的功能,在提交事件产生url.If一个没有定义的参数,增添网址应跳过什么是正确的语法jQuery中
var category =$("#prod_category").val();
var group =$("#prod_group")
window.location.href = "/page/" +
**//add to url if category is definned**
encodeURI(category) + "/" +
**//add to url if group is definned**
encodeURI(group) + "/" +
值得关注的是你正在寻找香草JavaScript语法 - 没有必要使用jQuery作为'if's tatement。 – 2012-07-17 10:17:07