Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

add date into url as parameter

Posted on 2014-03-05
2
Medium Priority
?
215 Views
Last Modified: 2014-03-05
I have the following script that redirects a user to a web site.
I need to add yesterday's date to the end as paramater txtStartDate, i format 03/04/2014.  This way, each time someone clicks the link, the resulting page is already filtered for them.

<script type="text/javascript">
window.location.href = "http://corp.sec.state.ma.us/uccFiling/uccSearch/Default.aspx?SearchLapsed=False&rdoSearch=O&txtLast=&txtFirst=&txtMiddle=&txtSuffix=&txtICity=&txtIState=&txtName=John+Deere&txtOCity=&txtOState=&txtFilingNumber=&UCCSearchMethod=B&chkDebtor=&chkSecuredParty=S&chkAssignee=&lstDisplay=100&txtStartDate="
</script>
0
Comment
Question by:drelinger
  • 2
2 Comments
 
LVL 34

Accepted Solution

by:
Big Monty earned 2000 total points
ID: 39907013
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 39907032
of course, to format it, you'll need to come up with some code for that as well:

<script type="text/javascript">
function getTommorrowsDate() {
var newDate = new Date() - 1;
var dd = newDate;
var mm = newDate.getMonth();

var yyyy = newDate.getFullYear();
if( dd< 10){ dd='0'+dd }
if( mm < 10){ mm='0'+mm }
return = mm+'/'+dd+'/'+yyyy;
}

window.location.href = "http://corp.sec.state.ma.us/uccFiling/uccSearch/Default.aspx?SearchLapsed=False&rdoSearch=O&txtLast=&txtFirst=&txtMiddle=&txtSuffix=&txtICity=&txtIState=&txtName=John+Deere&txtOCity=&txtOState=&txtFilingNumber=&UCCSearchMethod=B&chkDebtor=&chkSecuredParty=S&chkAssignee=&lstDisplay=100&txtStartDate=" + getTommorrowsDate()
</script>

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
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…
Suggested Courses

916 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