I have the following form:
<form method="post" action="includes/do.php">
<input type="text" name="action" value="login" />
<input type="text" name="email" value="myemail@hotmail.com" />
<input type="text" name="pass" value="helloworld" />
<input type="submit" value="Send" />
</form>
Then, I want to catch the variables values before being submitted inside a firefox addon observer
. Notice that the form DOESN'T have the attribute: enctype="multipart/form-data"
. That's an important detail because I have a code that let me get the post data but it only works if enctype="multipart/form-data"
.
I'm sure I have to use:
var scrStream = Cc["@mozilla.org/scriptableinputstream;1"]
.createInstance(Ci.nsIScriptableInputStream);
but I have not get a working code so far (I'm a beginner).
I wanna get something like:
{
"action": "login",
"email": "myemail@hotmail.com",
"pass": "helloworld"
}
If you know about some function with the following interface, then better:
function get_post_data(channel) {
var data;
// ...
return data
}
Thank you!