Ad Space
Ad Space

Hosting Geared For
your CMSMS needs

CMSMS ready Hosting

Hosting Starting at $15

  • • Hosted Mail
  • • Personal Control Panel
  • • CMSMS 1.8.1 tested
  • • Lightly packed servers
  • • Intrusion Detection
  • • URL monitored
  • • Custom solutions available

Order your hosting Now

CP Blogs

jQuery and form submit in Chrome

Posted by: Jeremy Bass
on Jun 6, 2010

Category:

jQuery, HTML, Browsers - Compatibilities and Inconsistencies, Intermediate, Coding

Summary:

So you can't get jquery's $('form').submit(); to work in Chrome?


Ad Space

So you can't get jQuery's $('form').submit(); to work in Chrome?

It turns out that when you look that the form headers in the net the submit buttons value does not get pushed over. When you look at the other browsers, Internet Explore in fiddler and firebug in Firefox, you can see that the submit button values are sent in post.

The solution is to not submit the form but send a ajax post but not return false so that the page reloads with the post response. Simple..

	$('#CsearchSubmit').click(function() {
		if($("#CsearchName").val()=='Search by Name:'){
			$("#CsearchName").val('');
		}
		var Cname=$("#CsearchName").val();
		//$("#imgoptionprimer").remove();
	 // alert('Handler for .submit() called.'+Cname);
	 $.post("/company/company-search.html", $("#cd_searchform form").serialize());
	 // $('#cd_searchform form').submit();
	});

That is an example of the script that worked in everything but chrome till the $.submit() alternative. The replaced script is using $.post()

Hope that helps.. Cheers -Jeremy

Ad Space

Get Social With It

[+]

Add A Comment

[+]

Code in the picture:
Title:
Your Name(*):
Email:
Notify me of any further comments to this thread:
Website:
Comment(*):
 
Previous page: Hosting FAQ Next page: Experimental