Loading...


bookmark - Using The Post Method Without HTML Yeah, See the Above Line.

Using The Post Method Without HTML - Yeah, See the Above Line.

 
 Discussion by szupie with 7 Replies.
 Last Update: June 29, 2006, 5:16 pm
 
bookmark - Using The Post Method Without HTML Yeah, See the Above Line.  
Quickly Post to Using The Post Method Without HTML Yeah, See the Above Line. w/o signup Share Info about Using The Post Method Without HTML Yeah, See the Above Line. using Facebook, Twitter etc. email your friend about Using The Post Method Without HTML Yeah, See the Above Line. Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

I'm making a Firefox extension, and I need to use the POST method, which apparently is almost exclusively for HTML. Writing Firefox extensions is just like creating a web page, but the only difference is that you should avoid using HTML at all. Javascript, XML, etc. are fine. I've tried using the XMLHttpRequest function with AJAX, but I couldn't get it to work. So does anyone know how to POST information using any language but HTML? (Not GET. But it'd be much easier if I could use GET.)







   Tue Jan 24, 2006    Reply         

Yeah, POST and GET are exclusive to HTML. All other program languages have functions written to be able to use POST and GET.

I think you'll need to use sockets to pass data between the extention and the script. Unfortunately I have no idea of how to help you.

You might try some learn by example and take a peak at a similar extention if that is possible. I'm not a FF user and not interested in writting extentions for it. Just thought I should try to stear you away from the POST method.

Let me know if I'm wrong, I'd love to learn a new method. :)

vujsa







   Wed Jan 25, 2006    Reply         

Completely wrong, POST is a method of the HTTP Protocol, which means HTML is not the only language that can do it, but it may seem like the easiest way. So any HTTP capable client should be able to submit POST methods.

Maybe the RFC2616 will help you understand what the requirements are, unless you do want some code shown, any particular language? Remember you must follow the rules of message transmission for it to work as intended.


Cheers,


MC

   Wed Jan 25, 2006    Reply         


My question is why couldn't you get AJAX to work ? It's so darned simple. Need any help on that, check out the Shoutbox files - or the content of the Credits Reporter extension I was designing. Nothing better than AJAX to go with FF Extensions.

   Wed Jan 25, 2006    Reply         


Below was written on 1/25/2005, 07:40 AM EST
szupie

mastercomputers: I googled the RFC2616 thing. Wow... So much to read... I just wanted to know what languages would make the job the easiest.

miCRoSCoPiC^eaRthLinG: When I try AJAX in my extension, my script would stop in the middle, but it doesn't give any error report. I'm thinking it's something wrong with the send() part of the code. When I try the AJAX code in HTML, I get this error: Error: uncaught exception:

QUOTE

[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.setRequestHeader]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: file:///D:/xxxNameRemovedxxx/extensions/astau/chrome/chromeFiles/content/test.htm :: <TOP_LEVEL> :: line 6"  data: no]

I don't know what that means, since Mozilla doesn't have a manual on what error codes mean (or do they?). I'll try looking through your credits extension and the shoutbox code to see what I'm doing wrong.


Posts Merged
szupie

Below was written on 1/26/2005, 09:19 PM EST
szupie

OK, I found out that I had 2 problems in my javascript. The first one was with the send() statement. I did not put quotes around the parameters I wanted to pass (no one told me it needed to have quotes!). The second problem was in a later part of the script, where I tried to write the response to a new page. I was wrong about the AJAX not working, because this part was just plain javascript.

So now, my problem is this: how can I send information to a page with AJAX? I've used this page as a test page for my extension. For the send statement, my code is http_request.send('md5=hello');. Then, when the response comes back, I create a new page and document.write the response to the page. This page's status bar never finishes loading, and the page doesn't seem to have taken any parameters. I've studied the shoutbox code (the credits extension didn't have POST in its code), but I don't see how I've made a mistake. Did anyone spot anything wrong with my code?

   Fri Jan 27, 2006    Reply         

QUOTE (szupie)


I did not put quotes around the parameters I wanted to pass (no one told me it needed to have quotes!).

Link: view Post: 67886

Well before doing that just read the docs atleast once.. i hate reading docs but atleast i go through once what are the parameters possible and what it is types....

QUOTE (szupie)


For that send statement, my code is http_request.send('md5=hello');. Then, when the response comes back, I create a new page and document.write the response to the page. This page's status bar never finishes loading,

Link: view Post: 67886

Try to use like this
xmlHttpobj.open("POST","yourpage.php?md5=hello");
xml.Httpobj.send("");

check out your server is working properly..

QUOTE (szupie)


and the page doesn't seem to have taken any parameters. I've made a mistake. Did anyone spot anything wrong with my code?

Link: view Post: 67886

due to the browser behavious also u get some error (so problem is not from ur side)
Sometimes if u make request to some scripts repeatedly the broswer checks its cache if it available it gives from cache .. it does not go to original server.. So u will get confuse becaz u will the ouput that makes u feel that AJAX is working but u get the same result everytime becaz is it static from cache... u wont get proper response ... well how to solve this...
There is a solution for every problem.....
var myRand = parseInt(Math.Random() * 999999);
xmlhttpobj.open("POST",yourpage.php?md5=Hello&myRand="+myRand);
xmlhttpobj.onreadtstatechange = func.......
xmlhttpobj.send("");
so ur url is not the same at any time becaz a new random is attached so that it does not get one from cache... it feels it is something new and ask the server........

hope u can solve it if u get still problem post the AJAX related problem...

may i know what extension u r writting.......

:D

   Wed May 17, 2006    Reply         


Can't you use POST in XML?
I found something like this on w3schools and when I just went to have a look I got a domain parked message.
Anyway, I would love to give you a link but I'm sure Google, the god of link givers, would be nice enough to help you out.

   Mon Jun 26, 2006    Reply         

QUOTE (szupie)


I'm making a Firefox extension, and I need to use the POST method, which apparently is almost exclusively for HTML. Writing Firefox extensions is just like creating a web page, but the only difference is that you should avoid using HTML at all. Javascript, XML, etc. are fine. I've tried using the XMLHttpRequest function with AJAX, but I couldn't get it to work. So does anyone know how to POST information using any language but HTML? (Not GET. But it'd be much easier if I could use GET.)

Link: view Post: 67669


Im not really sure i get what yu want to do... but this might help. I use AJAX to submit my form using the Post method. Heres my code:

CODE


function AJAXInteraction(url, callback) {

var req = init();
req.onreadystatechange = processRequest;

function init() {
if (window.XMLHttpRequest) {
return new XMLHttpRequest();
} else if (window.ActiveXObject) {
return new ActiveXObject("Microsoft.XMLHTTP");
}
}

function processRequest () {
// readyState of 4 signifies request is complete
if (req.readyState == 4) {
// status of 200 signifies sucessful HTTP call
if (req.status == 200) {
if (callback) callback(req.responseXML);
}
}
}

this.doGet = function() {
req.open("GET", url, true);
req.send(null);
}

this.doPost = function(str) {
req.open("POST",url,true);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
req.send(str);
}
}


And I use it like this:

CODE


var url = "/MyServlet";
var querystr = "opt=NBCA&optionx=APPROVE&date_created=${param.date_created}";
var ajax = new AJAXInteraction(url, approveResponse);
ajax.doPost(querystr);



You should be able to adapt this to suit your needs :(

   Thu Jun 29, 2006    Reply         

Quickly Post to Using The Post Method Without HTML Yeah, See the Above Line. w/o signup Share Info about Using The Post Method Without HTML Yeah, See the Above Line. using Facebook, Twitter etc. email your friend about Using The Post Method Without HTML Yeah, See the Above Line. Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

HTML 101 - Web Design For Beginners

HTML 101 - Web Design For Beginners Absolute Basic HTML Writing This will be part one of a multi-part HTML tutorial. Please don't post advanced HTML replies to this ...more

   22-Feb-2005    Reply         

Where Can I Learn Html Codes ?

does anyone know a good website with html codes? ...more

   10-Dec-2005    Reply         

Get The Most From Your Post

I write very large posts here. I usually write very large posts other places I go as well and if anyone has received a PM from me you know I write a lot there too. I have an ability to take the smallest idea and write on and on about it. I'll write about the color, size, texture, weight, tast ...more

   06-Jul-2006    Reply         

How Do I Find The Binary, Oct, Hex Of This?! AH!   How Do I Find The Binary, Oct, Hex Of This?! AH! (3) (2) External XUL Files How to include them inside a main XUL files  External XUL Files How to include them inside a main XUL files