EE Insider Tips
Sponsored by EE Screencasts
ExpressionEngine mini-howtos created by the EE Insider community.
Using EE’s XID in Ajax
If you’re submitting data in the EE CP through Ajax you may run into some issues where you’re constantly 302 redirected back to the homepage. One reason for this is you’re not submitting an XID hash to ensure the security of your form.
To fix this simply add the following somewhere in the data to-be-submitted:
{...'XID': '<?=$FNS->add_form_security_hash('{ XID_HASH }')?>'...}
[Note: Remove the spaces from around XID_HASH, keeping them in was breaking the display.]
That should ensure you get past the XID check.
Email
Print
Post to Twitter
Post to Delicious
Add Your Comment?
You must have an EE Insider account to post comments on Insider Tips. It's fast, easy and hassle-free.
Sign up now (or login).