开发者

jQuery query string issue

I am trying to initialize some jQuery to only run if a specific querystring is found. However I am having trouble matching the querystring in an IF statement. My code is below.

$(document).ready(function(){
        if($(window.location.search == '?uploaded=success')){
            alert('test has worked');
        }
    });

At the minute this if statement is being ran whether ?uploaded=s开发者_开发知识库uccess is there or not. Can anyone help shed some light on this?


    if($(window.location.search == '?uploaded=success')){

should be

    if(window.location.search == '?uploaded=success'){


if($(window.location.search == '?uploaded=success')){...!?

You mean:

if (window.location.search == '?uploaded=success')

or:

if ($(window.location.search) == '?uploaded=success') {
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜