1

I'm using the wp.template() to create a BackBone JS template which comes with WordPress by default.

I have a template defined as:

<script type="text/html" id="tmpl-pre-registration">
    <div className="stvp-preregistration">
        <form className="stvp-preregistration__form" id="stvp-preregistration__form">
            <label htmlFor="stvp-preregistration__email-input">{{ data.name }}</label>
            <input placeholder='Email' type="email" name="stvp-preregistration-email-input" id="stvp-preregistration-email-input"/>
            <input id="stvp-preregistration__email-submit" type="submit" disabled />
        </form>
        <p className="stvp-preregistration__message">Some Message</p>
    </div>
</script>

I am trying to set certain values in the template which I receive from Ajax response.

But my Ajax response includes the above script with it.

enter image description here

As you see, I just want the response to be: {"success":false,"exit":false}

Can anyone explain why this happens?

  • how did you included this? – Vishwa May 8 at 5:28
  • I solved this, I included it using require_once, now I've included it using the wp_footer hook – Siddharth Thevaril May 9 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.