Wednesday, February 25, 2009

[jQuery] Re: jQuery Form Plugin redirects even if I use return false in $('#myForm2').submit(function()

Hi ,

As you said I put the try catch.. Again, I dint even see the alert
msg :( It redirected the page
to sell.php5

I am once again pasting the exactl code I have for your kind notice.
--------------------------------------------------------------------------------------------------------------------------------------------------------------
<html>

<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="form.js"></script>
<script type="text/javascript">

function processXml(responseXML) {

try {
var message = $('message', responseXML).text();
alert(message);
} catch(err)
{
txt="There was an error on this page.\n\n";
txt+="Error description: " + err.description + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
}
}


$(document).ready(function() {

var options = {

url: 'http://www.odibab.com/ostore/sell.php5',
dataType: 'xml',
success: processXml // post-submit callback

};

$('#htmlForm').submit(function() {

$(this).ajaxSubmit(options);


//alert('john');

return false;
});


});


</script>
</head>

<body>

<form id="htmlForm" action="http://www.odibab.com/ostore/sell.php5"
method="post">
Message: <input type="text" name="message" value="Hello HTML" />
<input type="submit" value="Echo as HTML" />
</form>

<div id="output2"> </div>
</body>
</html>
------------------------------------------------------------------------------------------------------------------------------------------------------------------


On Feb 26, 12:10 am, MorningZ <morni...@gmail.com> wrote:
> Chances are VERY likely that your function "showResponse" is throwing
> an error in JavaScript, making the rest of the script stop running,
> and as a result allowing the page/browser to make a normal, page
> changing, post
>
> comment out all the code in said function, or wrap it in a
> try...catch  to see if you can figure out what is happening
>
> On Feb 25, 1:53 pm, Mike Alsup <mal...@gmail.com> wrote:
>
> > > showRequest doesnt do anything. It just print the returned data.
>
> > > Hey one more thing I noted, this plugin works fine with IE but not
> > > Mozilla :(
>
> > > Any workaround??
>
> > I'm afraid you haven't provided enough information.  The plugin works
> > fine with both FF and IE so there is something more to the story on
> > your end.
>
> > Mike

No comments: