1

I am trying to load a url with javascript which has variables as querystring parametres. Here is my code:

var username = params.username;
var password = params.password;

if(document.URL.indexOf("2") != -1) {
    var auto_refresh = setInterval(function () {
        var t = Date.now();
        $('#show').load('http://*******/updates/update2.php?username=username&password=password');
    }, 30000);   

1 Answer 1

4

Just try with:

$('#show').load('http://******/updates/update2.php?username=' + username + '&password=' + password);

Or with jQuery:

$('#show').load('http://*****/updates/update2.php?' + $.params({
  username: params.username,
  password: params.password
}));
Sign up to request clarification or add additional context in comments.

1 Comment

Yes it worked! I will aprove your answer in 4 minutes. Thanks a lot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.