|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Saving form data in XUL ?
I've been searching all over the net for the past couple of hours for examples .. but the ones I've found are not working.
So, I hope somebody will be able to help me. The problem is about building some backend for a site using XUL as interface language .. as all of us know, there is no such thing as form submit in XUL, so we have to use JavaScript in order to handle this. The problem I'm experiencing is with sending data using XMLHttpRequest object. I found some example like this var url="http:///xul/saver.php"; var xrequest=new XMLHttpRequest(); xrequest.open("POST",url,false); xrequest.send(null); var result=xrequest.responseText; The saver.php file looks like this: <?php echo $_SERVER['REQUEST_URI']; print_r($_REQUEST); ?> So as far as I understand, I have to put the data I wish to send into the send method of the XMLHttpRequest. Whenever I do that .. nothing actually happens .. I mean, no request variables appear. I do the request like this: var url="http:///xul/saver.php"; var xrequest=new XMLHttpRequest(); xrequest.open("POST",url,false); xrequest.send("id=1"); var result=xrequest.responseText; By the way, maybe there are some examples about this that I've missed? If anybody is able to help, thanks in advance. |
|
#2
|
|||
|
|||
|
hmm .. probably the problem was with headers .. but this one is working.
<script> var objHTTP, strResult; objHTTP = new XMLHttpRequest(); objHTTP.open("POST","index.php",false); objHTTP.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); objHTTP.send("id=1&kaka=some other string"); strResult=objHTTP.responseText; alert(strResult); </script> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Saving form data in XUL ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|