ajax - Problems passing jQuery $.post a variable as a parameter -


I'm trying to send a name: $ pair value in php script. Value variables I have sent the variable to the console in FF, so I know that they are being set properly, but when I send the header, only the value variable is being evaluated, the name is The name of the variable being sent as a literal string. Here the task is completely:

  $ (document) .ready (function () {$ ('# forms form fieldet & gt; input'). Blur (function () {if ( $ (This) .val () == '' & amp; amp; $ (this) .prev (). ('IMG')) {$ (this) .prev (). Remove (); Return;} If (($ (This) .is ('# forms form fieldet'; input [id * = mail] ')) ($ (this) .is (' # forms form fieldet '; input [id * = name ]] '))) & Amp; ($ (this) .val ()! = "")) {Var email_field = $ (this); if (! $ (This) .prev () is (' img ' }) {$ ('& Lt; img src = "" alt = "" style = "width: 16px; height: 16px;" />').insertBefore(this);} var type = ($ (this) ('Input [id * = sername]'))? 'Username': 'email'; var value = $ (this) .val (); $ .post ('checkemail.php5', {type: value} , F Quote (data) {if (data == "free") {email_field.prev (). Attr ('src', '/ images / greentick.png'). Attr ('alt', 'available');} else If (data == "taken") {email_field.prev (). Attr ('src', '/ images / redcross.png'). Attr ('Alt', 'taken');} and {console.log ('Hmmm' + data); }}); }}); }); Therefore, the header is being sent, the literal string is  type , and if any  value  evaluates it Why is there any idea?   

Because syntax {} takes a set of names: values ​​where names get property on the object It is a literal And there can not be a variable, as you see. Use it:

  var params = {}; Params [type] = value; Pass parameters instead of  

and {type: value}


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -