I defined a div within which MySQL table data returned by PHP via AJX to a form with default input value Call is added on the basis of. Call.
The Deal looks like this:
& lt; Div id = "esfContainer1" & gt; & Lt; / Div & gt; & Lt ;! - End esfContainer1 div - & gt; The digi is fully positioned relative to the body tag.
The script related to the form verification was broken when it was included on the main page where the call form was being created, so I took it into the PHP output $ form content.
Here is the form validation and submit the script included in the PHP output:
& lt; Script type = "text / javascript" & gt; Var sender name = $ ("#Sendname"); Var Sender Email = $ ("# fromemailAddress"); Var recipient email = $ ("# toemailAddress"); Var Email Error = $ ("# esemailerrorDiv"); SenderName.blur (checkName); SenderEmail.blur (checkSEmail); RecipientEmail.blur (checkREmail); Function checkname () {if (senderName.val () == "your name") {$ ("# esemailerrorText") Html ("Please provide your name"); $ (EmailError) .removeClass ("esemailError"); $ (EmailError) .addClass ("esemailErrorNow"); $ (EmailError) .fadeIn ("fast", "linear"); $ (EmailError) .delay (2000) .fadeOut ("slow", "linear"); return false; } And {return true; }}; Function checkmail () {var a = sender email.val (); Var filter = / ^ ([\ w - \. +) + ((\ [[0- 9] {1,3} \ [0- 9] {1,3} \. [0- 9] { 1,3} \) | (([\ w -] \) +)) ([a-zA-z] {2,4} | [0-9] {1,3}) (\?) ) $ /; If (filter.test (A)) {return true; } And {$ ("# esemailerrorText"). Html ("Please enter a valid email address"); $ (EmailError) .removeClass ("esemailError"); $ (EmailError) .addClass ("esemailErrorNow"); $ (EmailError) .fadeIn ("fast", "linear"); $ (EmailError) .delay (2000) .fadeOut ("slow", "linear"); return false; }}; Check the function () {var a = recipientEmail.val (); Var filter = / ^ ([\ w - \. +) + ((\ [[0- 9] {1,3} \ [0- 9] {1,3} \. [0- 9] { 1,3} \) | (([\ w -] \) +)) ([a-zA-z] {2,4} | [0-9] {1,3}) (\?) ) $ /; If (filter.test (A)) {return true; } And {$ ("# esemailerrorText"). Html ("Your friend's email is invalid"); $ (EmailError) .removeClass ("esemailError"); $ (EmailError) .addClass ("esemailErrorNow"); $ (EmailError) .fadeIn ("fast", "linear"); $ (EmailError) .delay (2000) .fadeOut ("slow", "linear"); return false; }}; $ ("# EmailForm") Submit (function () {if checkName () & amp; amp; & amp; amp; amp; check & nbsp; SEE (& amp; amp; amp; & nbsp;) Check Mail ()) {var emailerData = $ (" $ .get ("style.php", emailerData, processEmailer) .error ("Ouch"); function process emailer (data) {if (data == "unsuccessful") {return false ;} ("Slow", "linear"), and $ ("slow", "linear"); $ ("slow", "linear"); $ ("slow", "linear"), $ ("Slow", "linear"); $ ("# background opacity"). Delay (2000) .fadeaut ("slow", "linear"); return false ;}}; Return Back;}; Details I have sprinted up; Submit the above mentioned work with "return false"; Because the submission function is only processing $ PHP instead of PHP PHP Seeing the submit function with the firebug report, that processEmailer is undefined. I am very new to this, I was assuming that because AJAX callback is being defined in the rendering function ( And that's a Eks call process Imelder function is defined directly below) will have no problem with that definition.
Thanks in advance for any help.
You are trapped. Functional announcements (which will be hoisted) are not allowed inside the block ( If / for other / bodies) and if they appear there, then behavior is not defined. Firefox conditionally defines them, and in your case after that you have it $ Received in call - where it was undefined then - as in To resolve this, keep it simple if out of the block (or even outside the whole callback). BTW, .error ("Ouch") will not work, you have to pass the function. $ ("# emailForm") Submit (function () {If (checkName () & amp; amp; amp; amp; amp; check & nbsp; SEEML) & amp; amp; amp; & amp; amp; check & Amp; RF Email (); function () (function {} {console.log ("ouch")}}}} return false; // Now a proper function declaration will be hoisted: function process eMaker {data} { "$" ("#") "$" ("#") "$" ("#"). "Slow", "linear"); $ ("# esfContainer1"). Delay (2000) ("Slow", "linear"); $ ("# background opacity"). Delay (2000) .Fadeaut ("slow", "linear"); return false;}}}); < / Pre>
No comments:
Post a Comment