2013-03-02 02:28
浏览 55

使用jQuery AJAX获取语法错误[关闭]

I am new to jQuery and am trying to copy an example from a website I found that uses AJAX I need to take the PHP variable and pass it to another PHP page without refreshing the entire page. I have come up with the following code below but I am getting a syntax error

Uncaught SyntaxError: Unexpected token )

Here is my code:

    var textBox = $("textBox").val();
    {textBox: textBox},

My PHP page:

    <script type='text/javascript' src='script.js'></script>
    <script type='text/javascript' src=''></$
    <title>LCD Display</title>

        <form id="lcd" action="script.php" method="post">
     <input name='textBox' type='text' />
     <input type='submit' id= 'Button' value='Press to see something cool'/>
    <div id='ResponseDiv'>

    <iframe id="video" src="" height="120" width="160"></iframe>


I am also getting the following errors but I think they may be related to the syntax error:

Resource interpreted as Document but transferred with MIME type multipart/x-mixed-replace: "".
Resource interpreted as Document but transferred with MIME type image/jpeg: "".

图片转代码服务由CSDN问答提供 功能建议

我是jQuery的新手,我试图从我发现使用AJAX的网站复制一个例子我需要带 PHP变量并将其传递给另一个PHP页面而不刷新整个页面。 我在下面提出了以下代码,但是我收到了语法错误

Uncaught SyntaxError:Unexpected token)


 var textBox = $(“textBox”)。val(); \  n $ .post(“script.php”,
 \  n 


 &lt;!DOCTYPE HTML PUBLIC“ -  // W3C // DTD HTML 4.01 // EN”“http://www.w3  .org / TR / html4 / strict.dtd“&gt; 
&lt; head&gt; 
&lt; script type ='text / javascript'src ='script.js'&gt;&lt; / script&gt; 
&lt; script  type ='text / javascript'src =''>&lt; / $ 
&lt; title&gt; LCD Display&lt;  ; / title&gt; 
&lt; / head&gt; 
&lt; body&gt; 
&lt; form id =“lcd”action =“script.php”method =“post”&gt; 
&lt; input name =  'textBox'type ='text'/&gt; 
&lt; input type ='submit'id ='Button'value ='按下以查看酷炫的内容'/&gt; 
&lt; / form&gt; \  n&lt; div id ='ResponseDiv'&gt; 
&lt; / div&gt; 
&lt; iframe id =“video”src =“”height =“120”width =  “160”&gt;&lt; / iframe&gt; 
&lt; / body&gt; 
&lt; / html&gt; 

我也遇到以下错误但 我认为它们可能与语法错误有关:

 资源被解释为Document但是使用MIME类型传输multipart / x-mixed-replace:“  :8081 /“。
Resource解释为文档,但使用MIME类型image / jpeg传输:”".
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • douhui8025 2013-03-02 02:40

    Your closing tags:


    should be this way:

    var textBox = $("textBox").val();
        {textBox: textBox},

    and script order will be this way and mind the closing </$:

    <script src=''>
    <script type='text/javascript' src='script.js'></script>
    <title>LCD Display</title>

    打赏 评论
  • douzhi1937 2013-03-02 02:33
         {textBox: textBox},

    Also read :

    打赏 评论

相关推荐 更多相似问题