javascript - Call JQuery function when asp.net page has specific query string -


i have jquery function shows notification message. asp.net page want call when page gets loaded e.g when: request.querystring[c_opid] != null; tried call function page_load , page_loadcomplete using scriptmanager.registerstartupscript() function doesn't fire up. on other hand, when call on button click should done.

jquery function:

function showmessage(title, message) {     pnotify.prototype.options.styling = "jqueryui";     var notice = new pnotify({         title: title,         text: message,         type: 'success',         opacity: 1,         animate_speed: 'fast',         addclass: 'custom'     });     notice.get().click(function() {         notice.remove();     });     settimeout(function() {         notice.remove();     }, 3000); } 

asp.net code behind call:

            scriptmanager.registerclientscriptblock(this, this.gettype(), "script", @"showmessage('" + title + "','" + message + "');", true); 

alternative pure js

all need parameter url javascript. here 1 solution (copied how can query string values in javascript? )

function getparameterbyname(name) {     name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");     var regex = new regexp("[\\?&]" + name + "=([^&#]*)"),         results = regex.exec(location.search);     return results === null ? "" : decodeuricomponent(results[1].replace(/\+/g, " ")); } 

and then

$(function () {      if (getparameterbyname('your_parameter_name')){         // show message     } }) 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -