0

what i Need

  • i need that on appending variable data url should in proper format.

url

url : "http://local-login.times.com/ticket_transaction/autosubmit_advance/"+evt_id/user+"?visitor_flag=1&source=get-direction-oneclick.

value of evt_id=2244 and user=45566.

problem is on appending these variable in url in jquery.

  • on click on link output

     http://local-login.10times.com/ticket_transaction/autosubmit_advance/0.012915232373744963?visitor_flag=1&source=get-direction-oneclick 
    

but output should be

http://local-login.10times.com/ticket_transaction/autosubmit_advance/2244/4566?visitor_flag=1&source=get-direction-oneclick.
  • where i have done wrong.
  • any suggestion are most welcome.
2
  • evt_id/user divides 2244 by 45566, yielding the decimal you see in your output. Commented Dec 10, 2014 at 14:28
  • result of your division correctly appended. Commented Dec 10, 2014 at 14:29

2 Answers 2

2

You are dividing the numbers in the string

+evt_id/user+
       ^

Hence why you are getting a decimal output.

+evt_id + "/" + user+
       ^^^^^^^^^^
Sign up to request clarification or add additional context in comments.

Comments

0

If you do evt_id/user, it will divide the numbers.

Do evt_id + "/" + user instead if you want to do concatenation.

See how to use the + operator for concatenation on this MDN page.

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.