I would like to display a message after that a user has been redirected to a page.
So, first step is that a user is on a "startpage" and have the option to be directed to another page for uploading a file.
So when the user uploads a file and clicks button, the user will be redirected to the "startpage" and in that "startpage" I would like to display a message.
I'm able to display a mess even on first time the user enteres the "startpage" but I would like to display the message only when he/she uploads.
once u upload the file , than pass querystring & redirect on startup page.. now based on querystring value u can identify & display message u want to show..
Please mark the answer if it helps you.
Ramani Sandeep (My Blog)
(MCTS, MCC-2011)
if caseid is not the parameter which indicates successful file upload then add new one something like fileupload=Success in redirect and check this value.
<script type="text/javascript">
$(document).ready(function () {
var value = getQuerystring('caseid');
if(value != null) {
$("#successLabel").html("Kompletteringen till detta ärende har framgångsrikt laddats upp").fadeOut(2000);
}
});
//This function is used to return a parameter you specify
//in the URL. It uses regex to retrieve value of the key. Otherwise, a default
//value can be used when key does not exist.
function getQuerystring(key, defautlt_) {
if (default_ == null) defautlt_ = "";
key = key.replace((/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}
</script>
But now the problem is, it looks like the script is not even running...
Grendizer
Member
1 Points
30 Posts
jQuery + postback?
May 06, 2010 09:53 AM|LINK
Hi all,
I would like to display a message after that a user has been redirected to a page.
So, first step is that a user is on a "startpage" and have the option to be directed to another page for uploading a file.
So when the user uploads a file and clicks button, the user will be redirected to the "startpage" and in that "startpage" I would like to display a message.
I'm able to display a mess even on first time the user enteres the "startpage" but I would like to display the message only when he/she uploads.
<script type="text/javascript"> $(document).ready(function () { $("#successLabel").html("Message").fadeOut(2000); }); </script> <span id="successLabel"></span>sandy060583
Star
8714 Points
1624 Posts
Re: jQuery + postback?
May 06, 2010 10:28 AM|LINK
once u upload the file , than pass querystring & redirect on startup page.. now based on querystring value u can identify & display message u want to show..
Ramani Sandeep (My Blog)
(MCTS, MCC-2011)
Grendizer
Member
1 Points
30 Posts
Re: jQuery + postback?
May 06, 2010 10:46 AM|LINK
Hi
Thanks for your replay, but I don't think i'm quite following you.
This is my redirect statement:
Response.Redirect("Case.aspx?caseid=" + Request.QueryString["caseuniqueid"].ToString(), true);And my URL after the redirect looks like this:
http://localhost:53769/Admin/Case.aspx?caseid=5547
SSA
Star
9368 Points
1576 Posts
Re: jQuery + postback?
May 06, 2010 11:25 AM|LINK
Pass querystring when successful upload, access it in Jquery, you are already doing it i.e. caseid
now fetch the value in jquery, you can use this function
(check http://www.bloggingdeveloper.com/post/JavaScript-QueryString-ParseGet-QueryString-with-Client-Side-JavaScript.aspx)
or http://plugins.jquery.com/project/query-object this plugin to fetch value.
so
if querystring is not empty then show message.
now in
if caseid is not the parameter which indicates successful file upload then add new one something like fileupload=Success in redirect and check this value.
Grendizer
Member
1 Points
30 Posts
Re: jQuery + postback?
May 06, 2010 11:44 AM|LINK
Thank you!
So something like this sh'd be working...
<script type="text/javascript"> $(document).ready(function () { var value = getQuerystring('caseid'); if(value != null) { $("#successLabel").html("Kompletteringen till detta ärende har framgångsrikt laddats upp").fadeOut(2000); } }); //This function is used to return a parameter you specify //in the URL. It uses regex to retrieve value of the key. Otherwise, a default //value can be used when key does not exist. function getQuerystring(key, defautlt_) { if (default_ == null) defautlt_ = ""; key = key.replace((/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regex = new RegExp("[\\?&]"+key+"=([^&#]*)"); var qs = regex.exec(window.location.href); if(qs == null) return default_; else return qs[1]; } </script>But now the problem is, it looks like the script is not even running...
SSA
Star
9368 Points
1576 Posts
Re: jQuery + postback?
May 06, 2010 12:15 PM|LINK
Try this please.
Grendizer
Member
1 Points
30 Posts
Re: jQuery + postback?
May 06, 2010 01:53 PM|LINK
Thank you for your help! :)