定义变量时出现语法错误

时间:2012-10-21 01:58:13

标签: javascript jquery syntax

我在定义变量时遇到语法错误,我无法弄清楚原因。我对编码非常陌生,所以感谢任何帮助。

<script type="text/javascript">
jQuery("#submitSample").click(function(){
  var fullName        = jQuery("#fullName"       ).val();
  var eMail           = jQuery("#eMail"          ).val();
  var mailingAddress  = jQuery("#mailingAddress" ).val();
  var specialRequests = jQuery("#specialRequests").val();
  var inkOne          = jQuery("#inkOne"         ).val();
  var inkTwo          = jQuery("#inkTwo"         ).val();
  var inkThree        = jQuery("#inkThree"       ).val();
  var inkFour         = jQuery("#inkFour"        ).val();
  var designOne       = jQuery("#designOne"      ).val();
  var designTwo       = jQuery("#designTwo"      ).val();
  var designThree     = jQuery("#designThree"    ).val();
  data = "fullName="         + fullName +
         "&eMail="           + eMail + 
         "&mailingAddress="  + mailingAddress +
         "&specialRequests=" + specialRequests +
         "&inkOne="          + inkOne +
         "&inkTwo="          + inkTwo +
         "&inkThree="        + inkThree  +
         "&inkFour="         + inkFour +
         "&designOne="       + designOne  +
         "&designTwo="       + designTwo +
         "&designThree="     + designThree;
  jQuery.ajax({ type: "POST", 
                url: "http://www.famousartistprints.com/sample_form.php", 
                data: data, 
                success: function() {
                    jQuery("#couturePaypal").click();
                  }
    });
});
</script>

我在Chrome中打开它,这就是我得到的,我不确定它是什么意思。

SyntaxError: Unexpected token <
arguments: Array[1]
0: "<"
length: 1
__proto__: Array[0]
get message: function () { [native code] }
get stack: function () { [native code] }
set message: function () { [native code] }
set stack: function () { [native code] }
type: "unexpected_token"
__proto__: Error

1 个答案:

答案 0 :(得分:0)

我想通了,在Dreamweaver中,“script”标签会自动给出语法错误。我感到愚蠢:(。感谢所有的评论和帮助!