plugin development - wp.template() returns <script> tags in Ajax response

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

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.

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

Can anyone explain why this happens?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745516471a4631027.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信