Welcome Guest, Not a member yet? Register   Sign In
two views with javascript. One works, one doesn't. Why?
#1

(This post was last modified: 05-22-2019, 04:25 AM by richb201.)

I am using javascript to create 2 messages that I am sending from my CI program to my Chrome Extension. This is the first one that seems to run fine. I am calling it from a method in one of my controllers. The message snapshot_mode is correctly sent to the Chrome Extension.
Code:
<script language="javascript">

   $(document).ready( function() {
       var editorExtensionId = "lamacgnkfoiknjpleghfknfigbmhdaei";

       // Make a simple request:
       chrome.runtime.sendMessage(editorExtensionId, "snapshot_mode",
           function (response) {
               if (!response.success)
                   handleError(url);

           }
       )
   })

</script>


Later, when the user logs off the application I am calling this from a different function in the same controller:
Code:
<script language="javascript">



       var editorExtensionId = "lamacgnkfoiknjpleghfknfigbmhdaei";

       // Make a simple request:
       chrome.runtime.sendMessage(editorExtensionId, "snapshot_mode_unload",
           function (response) {
               if (!response.success)
                   handleError(url);

           }
       )


</script>
Almost exactly the same, right? The unload doesn't work. I haven't been able to debug the javascript code in phpStorm, but I know that the message is not arriving at the Extension. It is true in the code that shortly after calling the unload function above, I am clearing the session and then redirecting. Without debugging both the php and javascript at the same time, how can I solve this problem?
proof that an old dog can learn new tricks
Reply


Messages In This Thread
two views with javascript. One works, one doesn't. Why? - by richb201 - 05-22-2019, 04:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB