最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论