cancel
Showing results for 
Search instead for 
Did you mean: 

Embedded Seal disappears on postback.

Whenever I perform a postback on my page the embedded seal disappears.

 

Is there a way to keep this from happening?

 

note: If I do a refresh the seal reappears.

liveclass
Member
1 ACCEPTED SOLUTION

Accepted Solutions

 

Hi,

 

The Authorize.Net secure seal is relatively simple javascript that should load in the same way regardless of whether the page was loaded through a post or not.
I would have to guess something else is happening that prevents the javascript from running.

 

Thanks,

Joy

View solution in original post

Joy
Administrator Administrator
Administrator
5 REPLIES 5

 

Hi,

 

The Authorize.Net secure seal is relatively simple javascript that should load in the same way regardless of whether the page was loaded through a post or not.
I would have to guess something else is happening that prevents the javascript from running.

 

Thanks,

Joy

Joy
Administrator Administrator
Administrator

I'm running into this issue again using ASP.NET and C#.  Some of the ASP Form elements cause a "partial postback" onclick.  This causes the javascript to not reload the Authorize.net image.

 

I've also tried wrapping the ANS_customer_id in a page request manager like so:

 

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function () {
    var ANS_customer_id = "<my customer id>";
});

 

This did not work.  My guess is that "seal.js" needs to have the page request manager code added to handle partial postbacks.

 

In general it does not matter whether the external javascript is simple it not.  What matters is that I wrap it in prm.add_endRequest().  Much of the javascript on my ASP.NET site breaks on partial postback unless the page request manager is used.

I've also tried dynamically loading the javascript.  Using a solution found here

 

function loadjscssfile(filename, filetype) {
    if (filetype == "js") { //if filename is a external JavaScript file
        var fileref = document.createElement('script');
        fileref.setAttribute("type", "text/javascript");
        fileref.setAttribute("src", filename);
    }
    else if (filetype == "css") { //if filename is an external CSS file
        var fileref = document.createElement("link");
        fileref.setAttribute("rel", "stylesheet");
        fileref.setAttribute("type", "text/css");
        fileref.setAttribute("href", filename);
    }
    if (typeof fileref != "undefined") {
        document.getElementsByTagName("head")[0].appendChild(fileref);
    }
} loadjscssfile("//verify.authorize.net/anetseal/seal.js", "js"); //dynamically load and add this .js file

// Handle Partial Postback
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function () {
loadjscssfile("//verify.authorize.net/anetseal/seal.js", "js");
});

 

 

This did not work either.

I tried this:

 

function pageLoad(sender, args) {
    <copied and pasted the code I found here: https://verify.authorize.net/anetseal/seal.js>
}

In this case, the page loaded everything and then quickly replaced everything with the Authorize.Net seal.