title: Unexpected token r in JSON at position 0(...)
body: <p>I'm now developing a web server based on STM32 MCU. The browser send request to MCU then MCU response a web html file. User can further set the parameters and using form to submit the parameters back to MCU for broadcasting. Now I got a problem with it. I try to send the data of form in JSON data type. But somehow it return me an error. "Unexpecteded token r in JSON at position 0(...)". Here is my code for submit.</p>
  
  <pre><code>$(document).ready(function(){
      // click on button submit
  
      $("#broadcastform").on('submit', function(e){
          e.preventDefault();
          $.ajax({
              url: '192.168.0.10',
              type : "POST",
              dataType : 'json',
              data: $(this).serialize(),
              success : function(result) {
              console.log(result);
              alert($(this).serialize());
              },
              error: function(xhr, resp, text) {
              console.log(xhr, resp, text);
  
          }
      })
  });
     });
  </code></pre>
  
  <p>You can see I set the url as 192.168.0.10 which is the ip of my MCU Platform. And here is my form code.</p>
  
  <pre><code>&lt;form name="broadcastform" id="broadcastform" method="post" action=""&gt;  
  
  
      &lt;h1 id="broadcast_title" style="color:rgba(255,255,255,0.7);font-size: 250%;font-weight: 400;margin-top:-10px" align="middle"&gt;BROADCAST&lt;/h1&gt;
      &lt;hr style="border-color:#ffffff;weight:40%;margin:0 auto;margin-bottom:20px"&gt;
      &lt;center class="page_intro"&gt;
      &lt;div style="margin-top:-1%;color:rgba(255,255,255,0.7);width:90%;margin-bottom:12.5%" class="page_intro"&gt;
      &lt;font size="6" style="line-height: 150%"class="page_intro"&gt;&lt;center&gt;Welcome!&lt;/center&gt;&lt;/font&gt;
      &lt;font size="5" style=" padding-top:20px;line-height: 150%;font-weight:normal;opacity:0.7"class="page_intro"&gt;&lt;center&gt;This is a Tool to Configure and Broadcast Your Modulator. Please Follow the Steps and Fill in the Parameter Fields for Your Preference. Enjoy the Tour !&lt;/center&gt;&lt;/font&gt;
      &lt;/div&gt;
      &lt;/center&gt;
      &lt;!-- Page Basic Setting --&gt; 
      &lt;select name="InputSource"  class="required page_basic" style="margin-left:23%" form="broadcastform" &gt;
  
                  &lt;option value=""&gt;Broadcast Input&lt;/option&gt;             
                  &lt;option value="0"&gt;HDMIPhy&lt;/option&gt;             
                  &lt;option value="1"&gt;USB Streaming&lt;/option&gt;             
                  &lt;option value="2"&gt;MPEC-TS Interface&lt;/option&gt;             
                  &lt;option value="3"&gt;VIP(Ethernet)&lt;/option&gt;         
      &lt;/select&gt;
      &lt;select name="ModulationMode"class= "page_basic required" style="margin-left:23%" form="broadcastform"&gt;             
                  &lt;option value=""&gt;Modulation Mode&lt;/option&gt;             
                  &lt;option value="1"&gt;ATSC&lt;/option&gt;             
                  &lt;option value="2"&gt;DTMB&lt;/option&gt;             
                  &lt;option value="3"&gt;DVB&lt;/option&gt;             
                  &lt;option value="4"&gt;ISDB&lt;/option&gt;         
      &lt;/select&gt;           
      &lt;input type= "text" name= "ProviderName" placeholder="Provider Name" maxlength="16" class="required page_basic"&gt;      
      &lt;input type= "text" name= "ServiceName" placeholder="Service Name" maxlength="16" class="required page_basic" style="margin-bottom:8%"&gt;
  
      &lt;!-- Page IP Setting. Only with ETH Input Source--&gt; 
      &lt;input type= "text" name= "LocalIP" class="page_ip" placeholder="Local IP" style="margin-top:30px"  id="LocalIp"&gt;             
      &lt;input type= "text" name= "RemoteVIPAddr" class="page_ip" style="margin-top:7%" placeholder="Remote VIP Address" id="RemoteIp"&gt;
      &lt;input type= "text" name= "RemoteVIPPort" class="page_ip" style="margin-top:7%;margin-bottom:11.8%"  placeholder="Remote VIP Port"id="RemoteVIPPort"&gt;
  
      &lt;!-- Page RF Setting --&gt;              
      &lt;input type= "text" name= "RFOutFreq" class="page_rf" style="margin-top:7%" placeholder="RF Output Frequency"  id="RFOutFreq"&gt;
      &lt;input type= "text" name= "RFIfFreq" class="page_rf"style="margin-top:7%" placeholder="RF IF Frequency" id="RFIfFreq"&gt;         
      &lt;input type= "text" name= "RFBandwidth" class="page_rf" style="margin-top:7%;margin-bottom:11.8%" placeholder="RF Bandwidth" id="RFBandwidth"&gt;   
  
      &lt;!-- Page EncryptKey Setting --&gt;              
      &lt;input type= "text" name= "EncryptKeyLo" class="page_encrypt" style= "margin-top:13%" placeholder="Encrypt Key Low" id="EncryptKeyLo"&gt;  
      &lt;input type= "text" name= "EncryptKeyHi" class="page_encrypt" style=" margin-top:13%;margin-bottom:16.1%" placeholder="Encrypt Key High" id="EncryptKeyHi"&gt;
  &lt;input id="submit" type="submit" value="Submit" class="btn inner" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Anyone has idea about it? been stuck at this point for a long time.</p>
  
  <p>Also, when I added console.log($(this).serialize()); in my ajax code "error" part(which will be executed if i press submit). It shows nothing. It seems like a empty object. But I just do the form.submit(); My MCU can receice "x-www-form-urlencoded" data.</p>
  
  <p>I checked the console again. The response text is not in json form. It is still in urlencoded form.</p>