English 中文(简体)
Backbone.js with php influence
原标题:Backbone.js with php interaction

我努力创建用户与主干的互动网页。 js & php。 但是,在我提交html表格时,我能够称职。 任何人都能够帮助我?

这里是法典

        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.js"></script>
    <script type="text/javascript" src="http://documentcloud.github.com/underscore/underscore.js"></script>
    <script type="text/javascript" src="http://documentcloud.github.com/backbone/backbone.js"></script>

    <!--- Here are the backbone code --->

    <script type="text/javascript">
     var FamilyModel = Backbone.Model.extend({ 
       defaults: { 
         name: "Corleone" 
       },
       url: "back.php"
     }); 

     var FamilyList = Backbone.Collection.extend({
       model: FamilyModel 
     });


    var FamilyListView = Backbone.View.extend({  
        el: $( #SampleForm ),
        model: FamilyModel,
        events: {
           click #Submit :  createOne 
        },
        createOne: function(e){
        e.preventDefault();

           alert( Yes );
        }

     });

  // Fire up the application:
  window.App = new FamilyListView;
    </script>

<!-- //HTML -->
<form name="SampleForm" id="SampleForm">
<table>
<tr><td>Name:</td><td><input type="text" name="varName"></td></tr>
<tr><td>Age:</td><td><input type="text" name="intAge"></td></tr>
<tr><td>Mobile:</td><td><input type="text" name="intMobile"></td></tr>
<tr><td colspan="2" align="center"><input type="submit" name="Submit" id="Submit" value="ADD"></td></tr>
</table>
</form>

Expecting your valuable response ASAP. Thanks

问题回答

你们需要推迟打电话<代码>(#SampleForm)的选任,直到OMM准备就绪为止。

反射物体的定义是物体字面,这意味着立即评估权利的价值。 由于它立即进行了评估,人力部没有准备就绪,因此无法找到你的形式。

我就此详细解释了这个问题和一些可能的解决办法:


You cannot call jquery there because the DOM is not created. Initialize your FamilyListView when the DOM is ready and your code should work.

$(document).ready(function(){
    var foo = new FamilyListView({el: $( form )});
}); 




相关问题
Using Backbone.js offline

I m evaluating Backbone.js for keeping data and UI synchronized in my web app. However, much of Backbone s value seems to lie in its use of RESTful interfaces. Though I may add server-side backup in ...

Server-side vs. Client-side (AJAX) Loading

I was wondering what is considered best practice. Let s say I have a dropdown select widget. Should it be preloaded with content when the page is served up from the server or once it is loaded, should ...

integrate yui with javascriptmvc

How to integrate yui with javascriptmvc? I want to use yui3.Tabview in my application based on javascriptMVC.

Does JavascriptMVC support bookmarkable URLs?

I am thinking of porting my current application to use JavascriptMVC + RESTfull web services. However, I am not sure if I can create bookmarkable URLs with JavascriptMVC. For example: the webapp is ...

Using Selenium-IDE with a rich Javascript application?

Problem At my workplace, we re trying to find the best way to create automated-tests for an almost wholly javascript-driven intranet application. Right now we re stuck trying to find a good tradeoff ...

荣誉勋章或书籍

我已经熟悉了javascript,但正在寻找一个全面的辅导或书,从最基本的内容来看,教我如何建立与乳房设计模式的接口。

Just In General: JS Only Vs Page-Based Web Apps

When a developing a web app, versus a web site, what reasons are there to use multiple HTML pages, rather than using one html page and doing everything through Javascript? I would expect that it ...

sproutcore vs javascriptMVC for web app development

I want to use a javascript framework with MVC for a complex web application (which will be one of a set of related apps and pages) for an intranet in a digital archives. I have been looking at ...

热门标签