Ajax yuam kev yog dab tsi?
Ajax yuam kev yog dab tsi?

Video: Ajax yuam kev yog dab tsi?

Video: Ajax yuam kev yog dab tsi?
Video: Yog Vim Dab Tsi - Maiv Choj (cover) 2024, Kaum ib hlis
Anonim

Lub ntsiab lus. Qhov no tshwm sim thaum jQuery poob rau hauv nws yuam kev callback handler (qhov no hu rov qab ua rau hauv DataTables), uas feem ntau yuav tshwm sim thaum lub server teb nrog lwm yam uas tsis yog 2xx HTTP txheej xwm code.

Yog li ntawd, Ajax txhais li cas?

AJAX = Asynchronous JavaScript thiab XML. AJAX yog ib txoj hauv kev los tsim cov nplooj ntawv web sai thiab dynamic. AJAX tso cai rau cov nplooj ntawv web kom hloov kho asynchronously los ntawm kev sib pauv cov ntaub ntawv me me nrog cov neeg rau zaub mov tom qab. Qhov no txhais tau tias tias nws muaj peev xwm hloov kho qhov chaw ntawm nplooj ntawv web, tsis tas yuav rov qab tag nrho nplooj ntawv.

Tsis tas li, koj yuav ua li cas thiaj li ua yuam kev hauv Ajax hu? Qhov zoo tshaj plaws ua npuas uas yuam kev los ntawm tus neeg rau zaub mov sab (siv php) mus rau tus neeg siv khoom sab yog xa cov header los ntawm Ajax thov qhov chaw hauv 400's (uas ib txwm cuam tshuam nrog yuam kev ). Ib zaug lub Ajax thov tau txais qhov no nws yuav ua rau koj yuam kev muaj nuj nqi.

Qhov thib ob, 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.

Dab tsi yog dataType hauv Ajax?

Hom ntaub ntawv puas yog koj qhia jQuery seb yuav teb li cas. Cia siab tias JSON, lossis XML, lossis HTML, thiab lwm yam. Lub neej ntawd yog rau jQuery sim thiab txheeb xyuas nws.

Pom zoo: