Parsing URL Parameters on runtime

For developers using the Construct 2 Javascript SDK

Post » Thu Mar 15, 2012 4:06 pm

Hi all,

I am putting my hands on my very first plugin, btw. I am quite new to JavaScript in total (my world was PHP before).

I was quite sure, that everything is set up quite well, but on runtime, all I get is a black screen (I am still on the last real stable version).

This is the action script I set up:

[code]
     //////////////////////////////////////
     // Actions
     pluginProto.acts = {};
     var acts = pluginProto.acts;

     acts.ParamGet = function (myparam)
     {
          var query = window.location.search.substring(1);
          var vars = query.split("&");
          for (var i=0;i<vars.length;i++) {
           var pair = vars.split("=");
           if (pair[0] == variable) {
              this.ParamValue = pair[1];
           }
          }
     };
[/code]

For instance Class I set up this:
[code]
     /////////////////////////////////////
     // Instance class
     pluginProto.Instance = function(type)
     {
          this.type = type;
          this.runtime = type.runtime;
          this.ParamValue = "";
     };
[/code]

I am also not yet familiar with the error console in Chrome and Firefox (never needed for PHP), I do hope someone can figure out what is my fault?

Here is a live example:
http://www.ubivis.de/test/?test=Bla

This should show up a textfield with the value of parameter "test"
B
42
S
9
G
6
Posts: 437
Reputation: 5,626

Post » Thu Mar 15, 2012 4:16 pm

Please forget my previous question... found my mistake now (after spending hours without having a clue).

It is still not working, but at least I did a big step forward ;)
B
42
S
9
G
6
Posts: 437
Reputation: 5,626

Post » Thu Mar 15, 2012 4:25 pm

All problems solved... will be released soon :)
B
42
S
9
G
6
Posts: 437
Reputation: 5,626


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests