Jump to content

Recommended Posts

Hi,

I am trying tocreate a simple form that do submit (form for mobiles).

But the code does not do a submit (debug it and the success function is not executed on submit).

here is the code:

				<form id="ContactForm"> 

					<p class="mandatory">

					</p>
					<div data-role="fieldcontain" class="text-field">
						<label for="LAST_NAME">שם מלא:</label>
						<input type="text" name="LAST_NAME" value="" placeholder="" class="required" id="LAST_NAME" />
					</div>
					<div data-role="fieldcontain" class="text-field">
						<label for="mobilephone">טלפון:</label>
						<input type="number" name="PHONE_MOBILE" value="" placeholder="" id="PHONE_MOBILE" /class="required" >
					</div>

					<div class="send">

						<a href="javascript:;" data-role="button" data-theme="a" data-iconpos="right" id="send">הרשמה!</a>
<input type="submit" name="submit" value="Submit" id="send1"/>

					</div>


					<input type="hidden" name="LEAD_SOURCE" value="MOBILE">
					<input type="hidden" name="ASSIGNED_USER_ID" value="fe1032ed-fbe7-44b7-b724-8b9dc7e6e01b">
					<input type="hidden" name="MODIFIED_USER_ID" value="">
				</form>

 

 

and the function:

$('.returnTopAction').live('click', function() {
   $('html, body').animate({scrollTop: '0'}, 700);
});
$('#gallery-page').live('pageshow', function () { 
	$myPhotoSwipe = $(".gallery a").photoSwipe({ enableMouseWheel: false , enableKeyboard: false });});

$('#send').live("click", function() {
			var url = 'http://crm.karusela.net/Leads/WebToLeadCapture.aspx';
			var error = 0;
			var $contactpage = $(this).closest('.ui-page');
			var $contactform = $(this).closest('.contact-form');
			$('.required', $contactform).each(function(i) {
				if($(this).val() === '') {
					error++;
				}
			})
			// each
			//alert($contactpage);
			if(error > 0) {
				alert('ERR');
			} else {
				//submit the form



$.ajax({type:'GET', url: url, data:$('#ContactForm').serialize(), 


					success : function(data) {
						alert("THIS FUNC DOES NOT EXECUTED");

						if(data == 'success') {
							// show thank you
							$contactpage.find('.contact-thankyou').show();
							$contactpage.find('.contact-form').hide();
						} else {
							alert('ERR.');
						}
					}




				});				

			}

			return false;
		});



Link to comment
https://forums.phpfreaks.com/topic/258781-jquery-help/
Share on other sites

Your form uses a SUBMIT button. When you do that the instruction for the submit is contained in the <form> tag. Normally it would look like this:

<form id="ContactForm" action="url of where the form is being sent" method="get or post">

 

You are missing the action and the method so it calls it's self and you have no php to handle it.

If you want the jquery to handle it change the button type to button and add an onclick.

Or have the jquery look for a click event.

Link to comment
https://forums.phpfreaks.com/topic/258781-jquery-help/#findComment-1326947
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.