AJax¼¼Êõ

ÔÚÏß֪ʶѧϰƽ̨(5)

×ÖºÅ+ ×÷ÕߣºH5Ö®¼Ò À´Ô´£ºH5Ö®¼Ò 2016-08-13 15:00 ÎÒÒªÆÀÂÛ( )

Èç¹ûÏëÒª·¢ËÍ£º ä¯ÀÀÆ÷¶Ë£ºXMLHttpRequestµÄwithCredentialsΪtrue ·þÎñÆ÷¶Ë£ºAccess-Control-Allow-CredentialsΪtrue ×¢Ò⣺·þÎñÆ÷¶ËÏìÓ¦µÄAccess-Control-Allow-Origin ²»ÄÜÊÇͨÅä·û * == = == script { var xhr

Èç¹ûÏëÒª·¢ËÍ£º

  • ä¯ÀÀÆ÷¶Ë£ºXMLHttpRequestµÄwithCredentialsΪtrue
  • ·þÎñÆ÷¶Ë£ºAccess-Control-Allow-CredentialsΪtrue
  • ×¢Ò⣺·þÎñÆ÷¶ËÏìÓ¦µÄ Access-Control-Allow-Origin ²»ÄÜÊÇͨÅä·û *
  • ==> > => ==> <script> { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(){ if(xhr.readyState == 4) { var result = xhr.responseText; console.log(result); } }; xhr.withCredentials = true; xhr.open('PUT', ":8000/test/", true); xhr.setRequestHeader('k1', 'v1'); xhr.send(); } { $.ajax({ url: ":8000/test/", type: 'PUT', dataType: 'text', headers: {'k1': 'v1'}, xhrFields:{withCredentials: true}, success: function(data, statusText, xmlHttpRequest){ console.log(data); } }) } > html : : self.set_header('Access-Control-Allow-Origin', "") self.set_header('Access-Control-Allow-Credentials', "true") self.set_header('xxoo', "seven") self.set_header('bili', "daobidao") self.set_header('Access-Control-Expose-Headers', "xxoo,bili") self.set_cookie('kkkkk', 'vvvvv'); self.write('{"status": true, "data": "seven"}') : self.set_header('Access-Control-Allow-Origin', "") self.set_header('Access-Control-Allow-Headers', "k1,k2") self.set_header('Access-Control-Allow-Methods', "PUT,DELETE") self.set_header('Access-Control-Max-Age', 10) tornado


    ·ÖÏí¸øС»ï°éÃÇ£º

    ±¾ÎıêÇ©£º Ajax/">Ajax

    Ïà¹ØÎÄÕÂ

    ·¢±íÆÀÂÛÔ¸ÄúµÄÿ¾äÆÀÂÛ£¬¶¼Äܸø´ó¼ÒµÄÉú»îÌíÉ«²Ê£¬´øÀ´¹²Ãù£¬´øÀ´Ë¼Ë÷£¬´øÀ´¿ìÀÖ¡£

  • ±¾Àà×îÈÈÐÂÎÅ

  • ¡¡

    1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

    Ïà¹ØÎÄÕÂ
    • »ùÓÚajax¼¼Êõµç´óÍøÉÏѧϰƽ̨Éè¼Æ¼°ÊµÏÖ.pdf

      »ùÓÚajax¼¼Êõµç´óÍøÉÏѧϰƽ̨Éè¼Æ¼°ÊµÏÖ.pdf

      2016-08-07 11:06

    • android²¼¾Ö¼¼ÇÉ£º´´½¨¸ßЧ²¼¾Ö

      android²¼¾Ö¼¼ÇÉ£º´´½¨¸ßЧ²¼¾Ö

      2016-05-13 17:00

    • UIϵÁÐÖ®: »ùÓÚJQUERYµÄWEBÔÚÏßÁ÷³ÌͼÉè¼ÆÆ÷GOOFLOW 0.8°æ

      UIϵÁÐÖ®: »ùÓÚJQUERYµÄWEBÔÚÏßÁ÷³ÌͼÉè¼ÆÆ÷GOOFLOW 0.8°æ

      2016-04-28 17:00

    • ajax¼¼ÇÉÖÆ×÷µÃÔÚÏ߸è´ÊËÑË÷¹¦Ð§

      ajax¼¼ÇÉÖÆ×÷µÃÔÚÏ߸è´ÊËÑË÷¹¦Ð§

      2016-02-06 14:47

    ÍøÓѵãÆÀ
    µ