AJAX thov thiab teb yog dab tsi?
AJAX thov thiab teb yog dab tsi?

Video: AJAX thov thiab teb yog dab tsi?

Video: AJAX thov thiab teb yog dab tsi?
Video: yog hmoov dab tsi tub huas xyooj 2024, Kaum ib hlis
Anonim

Kev tshaj tawm. Qhov no AJAX Ajax . Teb yog qhov khoom dhau los ua qhov kev sib cav thawj zaug Ajax thov hu rov qab. Qhov no yog wrapper ib ncig ntawm haiv neeg xmlHttpRequest object. Nws normalizes cross-browser teeb meem thaum ntxiv kev txhawb nqa rau JSON ntawm cov lus tebJSON thiab headerJSON cov khoom.

Ib yam li ntawd, nws tau nug, qhov kev thov Ajax yog dab tsi?

Ib AJAX thov yog a thov ua los ntawm ib AJAX daim ntawv thov. Feem ntau, nws yog HTTP thov tsim los ntawm (browser-neeg nyob) Javascript uas siv XML los encode lub thov cov ntaub ntawv thiab/los yog cov ntaub ntawv teb.

Ib tug kuj yuav nug, Kuv yuav ua li cas thov Ajax? Txhawm rau siv AJAX hauv JavaScript, koj yuav tsum ua plaub yam:

  1. tsim cov khoom XMLHttpRequest.
  2. sau cov haujlwm hu rov qab.
  3. qhib qhov kev thov.
  4. xa daim ntawv thov.

Yog li ntawd, dab tsi yog callback muaj nuj nqi hauv Ajax?

A callback muaj nuj nqi yog a muaj nuj nqi dhau li parameter mus rau lwm tus muaj nuj nqi . Yog tias koj muaj ntau tshaj ib AJAX ua haujlwm hauv lub vev xaib, koj yuav tsum tsim ib qho muaj nuj nqi rau kev ua tiav cov khoom XMLHttpRequest, thiab ib qho callback muaj nuj nqi rau txhua tus AJAX txoj hauj lwm.

Qhov txawv ntawm Ajax thov thiab HTTP thov yog dab tsi?

AJAX sawv cev rau asynchronous javascript thiab XML yog li yog tias koj siv javascript los thauj cov ntaub ntawv tom qab browser thov koj ua tiav lawm AJAX . REST ntawm qhov tod tes yog sawv cev rau Kev Sawv Cev Hauv Xeev uas yog Stefan Billet tau taw qhia txog kev siv HTTP thov hloov cov ntaub ntawv.

Pom zoo: