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') {
精彩评论