Use Firebug.  Make sure you're using the most recent version of  
Prototype.

Your sample works for me in Safari and Firefox.  The code could be a  
bit cleaner--it might make debugging easier.

This strip-down version does the same thing (it works too), and is a  
bit easier on the eyes (for me, at any rate). A bit of cleanup make  
it easier to debug.

function sendAjaxRequest() {
        var url = "echo.php";  //Changed url to match my test system.
        var myAjax = new Ajax.Request(url, {
                parameters: {
                        elementId: "1234",
                        content: 'content'
                },
                onComplete: function (request) {
                        alert(request.responseText);
                },
                onException: function (request) {
                        alert("Something went wrong...");
                }
        });
}


TAG

On Aug 5, 2007, at 9:07 PM, Adriano wrote:

>
> Hey Everyone, I'm trying to use prototype but I cannot seem to use the
> Ajax.Request in Firefox 2.0.0.6.  I've stripped it down to bare
> essentials and it runs fine in IE.  However, If I try to use it in
> FireFox, onException fires.
> Thanks for taking a look, any reply would be greatly appreciated!
> Adrian
>
>
> my "test.html":
> <html xmlns="http://www.w3.org/1999/xhtml";>
>       <head>
>               <title>my test</title>
>               <!-- TinyMCE -->
>               <script language="javascript" type="text/javascript"
>                       src="javascripts/prototype.js"></script>
>               <script language="javascript" type="text/javascript"
>                       src="javascripts/test.js"></script>
>       </head>
>       <body>
>               <input type="button" name="save" value="send"
>                       onclick="sendAjaxRequest();" />
>       </body>
> </html>
>
> my "javascripts/test.js":
> function sendAjaxRequest() {
>       var content = "content";
>       var elementId = 123;
>       var url = "http://localhost:8080/AjaxRequest/servlet/
> test.AjaxRequestServlet";
>       var content = "content";
>       var elementId = "1234";
>       var myAjax = new Ajax.Request(url, {method:"post", parameters:
> {elementId:elementId, content:content}, onComplete:showResponse,
> onException:error});
>       function error() {
>               alert("Something went wrong...");
>       }
>       function showResponse(originalRequest) {
>               var reply = originalRequest.responseText;
>               alert(reply);
>       }
> }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to