【发布时间】:2013-12-22 16:20:51
【问题描述】:
我正在尝试创建一个非常基本的书签。
我的表单存在于页面上,例如 mysite.com/posts/,在引导模式框中。
<div class="post-window">
<div class="window-left">
<textarea name="title_image" class="form-control" rows="3" placeholder="Post title"></textarea>
<input name="postimage" class="form-control" placeholder="Post image URL" />
</div>
</div>
<div class="modal-bottom">
<div class="upload">
<input type="hidden" name="letsbingo" value="1" />
<button class="btn-block">Post Selfie</button>
</div>
</div>
1- 以下是书签代码,它工作正常。
javascript: var selfiesite = 'SelfieNow',
selfiesiteurl = 'http://my.com/post/';
(function () {
if (window.selfiesiteit !== undefined) {
selfiesiteit();
} else {
document.body.appendChild(document.createElement('script')).src = 'http://my.com/assets/js/postit.js';
}
})();
2- 上面 javascript 的结果正是我想要的,如下所示
http://my.com/post/?postimage=%3A%2F%2Fexample.com%2Fwp-content%2Fuploads%2F2013%2F12%2FGripster-Wrap-Mini-For-The-Ipad-Mini-3-690x460.jpg&title_image=Example%20-%20Men%27s%20Gear%2C%20Lifestyle%20and%20Trends
3- 现在我的 my.com/post/ 包含一段 javascript,它在窗口加载时触发模态框。
jQuery(window).load(function ($) {
jQuery('#postModal').modal('show');
});
书签正在工作,模式框在窗口加载时打开。但是数据并没有传递给表单。表单在模式框中打开,url 更改但表单显示为空。我不知道出了什么问题。模式框以错误的方式打开(在窗口加载时),或者创建的小书签 url 不适合这种形式。请指导我一点。
【问题讨论】:
标签: javascript jquery forms twitter-bootstrap