0

My URL is

   /home/?tx_besijobs_pi1[pointer]=2&cHash=749431ca0340bf2344cc90704f79570f

My jquery code contain

    var pntr = getUrlVars()["tx_besijobs_pi1[pointer]"];

from which I am getting pointer value as 1,2,3,...

I have to change pointer value to 0 on next Tab click. My replace code looks like

    id =id.replace("[pointer]=pntr", "[pointer]=0");

But its not working...

If I am manually giving pointer value

    id =id.replace("[pointer]=2", "[pointer]=0");

the code will work . How can use "pntr" in the code?

2 Answers 2

1

pntr is a variable, so it should be outside the quotation marks.

Try this:

id = id.replace("[pointer]=" + pntr, "[pointer]=0");
Sign up to request clarification or add additional context in comments.

Comments

0

use regular expression like:

var url = '/home/?tx_besijobs_pi1[pointer]=2&cHash=749431ca0340bf2344cc90704f79570f';
alert( url.replace(/pointer\]=\d{1,}/gi, "pointer]=0"));

Comments

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.