javascript - jQuery - Illegal invocation when post -


I am creating a contact form and when I execute it, I receive the following error:

Unkit Type Error: Invalid Orientation

This is my code, what is wrong, if you want to see the problem live:

  $ (Document) .ready (function () {var submit = $ ('# contact input [type = "submit"]'); var name = $ ('# contact input [name = "name"]'); Var email = $ ('# contact input [name = "email"]'); var company = $ ('#' Input id [name = "company"] '); var phone = $ (' # contact input [name = "phone"] '); var Skype = $ (' # contact input [name = "skype"] '); Var budget = $ ('#contact ul.budget span.value'); var message = $ ('# contact textarea'); // verification $ (submit). (Function () {event.preventDefault () ; Var go ahead = true; If (name.val (). Length == 0) {$ (name) .addClass ('animated bounce'); go ahead = false;} if (email.val (). Length = = 0) {$ (Forwarded) Forwardclass ('Animated Bounce'); Go ahead = false;} if (budget.hasClass ('notset')) {$ ('budget.') AddClass ('animated bounce'); Forward = false;} (message .val (). Length == 0) {$ (Messa GE) .addClass ('animated bounce'); Go ahead = false; } If (name.val (). Length == 0 || email.val () length == 0 || budget.hasClass ('notset') || message.val (). Length == 0) {setTimeout (Function () {$ ('input, .budget, textarea). RemoveClass (' animated bounce ');}, 1000); } // if the form is filled properly (go ahead) {post_data = {'cName': name, 'cEmail': email, 'cCompany': company, 'cphone': phone, 'cskype': skype, 'cbudget ': Budget,' CMS ': Message}; $ .post ('contactsubmit.php', post_data, function (feedback) {if (response.type == 'error') {output = response.text;} and {output = response.text;} alert (output); }, 'Jason'); }}); });  

I have used it before, now I have made some changes in the verification, just cleaning it a bit and started messing with me.

Everyone can get grateful help.

Thank you!

You have data that looks like this

  post_data = '' CName '': name, 'CEM': email, 'cecpany': company, 'cephone': phone, 'cspp': skype, 'cbbf': budget, 'cmsus': message};  

Note that all the variables you reference are the jQuery objects

  var name = $ ('# contact input [name =' name ']') ; Var email = $ ('# contact input [name = "email"]'); Var company = $ ('# contact input [name = "company"]'); Var phone = $ ('# contact input [name = "phone"]'); Etc ...  

You can change the $. You can not send a jQuery object with the post , which is the "invalid greeting", you probably want to value instead

  var post_data = {cname: name.val ( ), CEmail: email.val (), etc ...}  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -