[jQuery] jQuery Form Plugin redirects even if I use return false
Hi all, I am using jQuery Form Plugin to submit a form to my php. I am using ajaxSubmit to achieve the same. But when I used it like this, --- $(document).ready(function() { var options = { target:'#output2', beforeSubmit: showRequest, dataType: 'xml', success: showResponse, url: 'index.php' }; $('#myForm').submit(function() { $(this).ajaxSubmit(options); return false; }); }); --- index.php content... Info'; ?> I am getting the output xml from the php in the same window. It never goes inside showResponse function. I donot want this page redirection to happen :( Instead I want to handle the returned xml (or any data) in jquery itself. Can anyone pleass help me ?? I am using Mozilla 3.0.6, Thanks in advance.
[jQuery] jQuery Form Plugin redirects even if I use return false in $('#myForm2').submit(function()
Hi all, I am using jQuery Form Plugin to submit a form to my php. I am using ajaxSubmit to achieve the same. But when I used it like this, --- $(document).ready(function() { var options = { target:'#output2', beforeSubmit: showRequest, dataType: 'xml', success: showResponse, url: 'index.php' }; $('#myForm').submit(function() { $(this).ajaxSubmit(options); return false; }); }); --- index.php content... Info'; ?> I am getting the output xml from the php in the same window. It never goes inside showResponse function. I donot want this page redirection to happen :( Instead I want to handle the returned xml (or any data) in jquery itself. Can anyone pleass help me ?? I am using Mozilla 3.0.6, Thanks in advance.
[jQuery] Re: jQuery Form Plugin redirects even if I use return false in $('#myForm2').submit(function()
Hi Thanks for replying back. 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?? Thanks On Feb 24, 4:45 am, Mike Alsup wrote: > > I am getting the output xml from the php in the same window. > > It never goes inside showResponse function. > > > I donot want this page redirection to happen :( > > Instead I want to handle the returned xml (or any data) in jquery > > itself. > > What does showRequest do? Can you post a link?
[jQuery] jQuery Form Plugin not working in Mozilla 3.0.6!!
Hi, I just downloaded jquery.form.js from http://malsup.com/jquery/form/#download The following code works fine in IE (The returned XML from server is displayed through alert() ) But when I use the same code in Mozilla 3.0.6, It fails. ( I am getting redirected to the sell.php5 page ) Can anyone help me please? Thanks, Antony Johnson And here is what I wrote - function processXml(responseXML) { var message = $('message', responseXML).text(); alert(message); } $(document).ready(function() { var options = { success: processXml // post-submit callback }; $('#htmlForm').submit(function() { $(this).ajaxSubmit(options); alert('Sending...'); return false; }); }); http://myserver.com/sell.php5"; method="post"> Message: ' . $_POST['message'] . ''; ?> -
[jQuery] Re: jQuery Form Plugin redirects even if I use return false in $('#myForm2').submit(function()
Hi Mike, Thanks a lot for your reply.. This is what I did exactly I just downloaded jquery.form.js from http://malsup.com/jquery/form/#download The following code works fine in IE (The returned XML from server is displayed through alert() ) But when I use the same code in Mozilla 3.0.6, It fails. ( I am getting redirected to the sell.php5 page ) Can anyone help me please? Thanks, Antony Johnson And here is what I wrote - function processXml(responseXML) { var message = $('message', responseXML).text(); alert(message); } $(document).ready(function() { var options = { success: processXml // post-submit callback }; $('#htmlForm').submit(function() { $(this).ajaxSubmit(options); alert('Sending...'); return false; }); }); http://www.odibab.com/ostore/sell.php5"; method="post"> Message: ' . $_POST['message'] . ''; ?> - On Feb 25, 11:53 pm, Mike Alsup 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
[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. -- 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; }); }); http://www.odibab.com/ostore/sell.php5"; method="post"> Message: -- On Feb 26, 12:10 am, MorningZ 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 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
[jQuery] Re: jQuery Form Plugin redirects even if I use return false in $('#myForm2').submit(function()
Hey,.. The problem seems weird.. The same page which worked well in IE is not working when I put the file into my server odibab.com and opened the page from IE. So, If i keep the same html page in my local windows and use It works But not when It is coming from odibab.com server. Any idea why this happening? Thanks in advance, Antony Johnson On Feb 26, 12:10 am, MorningZ 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 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
[jQuery] Re: jQuery Form Plugin redirects even if I use return false in $('#myForm2').submit(function()
Hi Eric, Thanks for helping me.. I did what you said, I got these two exceptions in the Mozilla Error console. Error: uncaught exception: [Exception... "Illegal document.domain value" code: "1009" nsresult: "0x805303f1 (NS_ERROR_DOM_BAD_DOCUMENT_DOMAIN)" location: "http://odibab.com/ ostore/test.html Line: 49"] Error: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "http:// www.odibab.com/ostore/jquery.js Line: 2700"] Source File: http://www.odibab.com/ostore/jquery.js Line: 2700 I dont know why the URI is in restricted? :( Thanks, Antony Johnson On Feb 26, 1:49 am, Eric Garside wrote: > In Firefox, open up the Error Console, clear it, then try submitting > the form and see if an error is getting tossed that way. > > Another option, is calling preventDefault(); on the event BEFORE your > processing code, so the form won't post, even if an error/exception is > thrown. > > $('#myForm').submit(function(evt){ > evt.preventDefault(); > // Other code here > > }); > > On Feb 25, 3:14 pm, "antcj...@gmail.com" wrote: > > > Hey,.. The problem seems weird.. > > > The same page which worked well in IE is not working when I put > > the file into my server odibab.com and opened the page from IE. > > > So, If i keep the same html page in my local windows and use It works > > But not when It is coming from odibab.com server. > > > Any idea why this happening? > > > Thanks in advance, > > Antony Johnson > > > On Feb 26, 12:10 am, MorningZ 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 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
[jQuery] Re: jQuery Form Plugin redirects even if I use return false in $('#myForm2').submit(function()
Hey Eric, My problem is solved!!! Thanks a million :) it's caused because I was loading the file into Firefox locally. If I upload it to our server and run it, it works fine. this was bcoz of some cross domain access policy in mozilla. I just found it after seeing the error console msg. Now all my referece (including .js and .php5) are to the same server. Hence it works fine :) :) Thanks a lot again.. On Feb 26, 1:49 am, Eric Garside wrote: > In Firefox, open up the Error Console, clear it, then try submitting > the form and see if an error is getting tossed that way. > > Another option, is calling preventDefault(); on the event BEFORE your > processing code, so the form won't post, even if an error/exception is > thrown. > > $('#myForm').submit(function(evt){ > evt.preventDefault(); > // Other code here > > }); > > On Feb 25, 3:14 pm, "antcj...@gmail.com" wrote: > > > Hey,.. The problem seems weird.. > > > The same page which worked well in IE is not working when I put > > the file into my server odibab.com and opened the page from IE. > > > So, If i keep the same html page in my local windows and use It works > > But not when It is coming from odibab.com server. > > > Any idea why this happening? > > > Thanks in advance, > > Antony Johnson > > > On Feb 26, 12:10 am, MorningZ 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 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