tips icon image

EE Insider Tips
Sponsored by EE Screencasts

ExpressionEngine mini-howtos created by the EE Insider community.

Using EE’s XID in Ajax

User's avatar
  • Posted by Mark Huot
  • February 02, 2010
  • 1 person has found this tip helpful.

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.

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).

Search EE Insider Tips
Sponsored By