Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

pass a query string on a buttonclick

Posted on 2001-09-14
6
Medium Priority
?
225 Views
Last Modified: 2008-02-01
I have a query string and when i click a button, that query string should be passed as a URL for the next page in the same window... Using ......

Window.Location.href="asp1.asp?Title=<% =Request.QueryString("xyz") %>

This is an example of how i tried for a Title field from a database.

the error i encountered was "Unterminated String Constant"...

The eror code is 1033. I hope iam correct...If anyone can help me sure do mail me soon........


S.Ramanujam (ramanujam@clearexperts.com)clearExpertsSolutions (p) Ltd,
A3, "CEEBROS RANGAM",
No.11, Cenatoph Road,
Teynampet, Chennai - 18

Phone: +91-44-4334619(off)
       +91-44-4334634(off)
       +91-44-3722375(res)

0
Comment
Question by:ramanujamsampath
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Expert Comment

by:bigbed
ID: 6482346
You have href="....
then you have another double-quoted string within it ("xyz"), and you don't have the terminating double-quote for the href attribute.

You need to escape the double-quotes in the QueryString("xyz") call, or use single-quotes there. And you need to add the closing double-quote.
Example using single-quote inside double-quotes (assuming single-quotes are legal in your ASP):
Window.Location.href="asp1.asp?Title=<% =Request.QueryString('xyz') %>"

0
 
LVL 5

Expert Comment

by:aryumin
ID: 6482364
Window.Location.href="asp1.asp?Title=<% =Server.URLEncode(Request.QueryString("xyz")) %>
0
 
LVL 5

Expert Comment

by:aryumin
ID: 6482372
Oops. Forget a closing quote :(
Window.Location.href="asp1.asp?Title=<% =Server.URLEncode(Request.QueryString("xyz")) %>";
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 200 total points
ID: 6482846
and to make it valid javascript you need to lowercase it and href is not needed to SET the url:
window.location="asp1.asp?Title=<% =Server.URLEncode(Request.QueryString("xyz")) %>";

Michel
0
 

Author Comment

by:ramanujamsampath
ID: 6486651
Thanx a lot for a wonderful answer..... It really worked at the first trial itself...

Ai. Alevidae
Cheers

S.Ramanujam (ramanujam@clearexperts.com)clearExpertsSolutions (p) Ltd,
A3, "CEEBROS RANGAM",
No.11, Cenatoph Road,
Teynampet, Chennai - 18

Phone: +91-44-4334619(off)
       +91-44-4334634(off)
       +91-44-3722375(res)

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6486945
Sorry guys - just making a comment - not trying to poach the question

Michel
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question