tag:blogger.com,1999:blog-865923359735383241.post5842361481141167206..comments2023-10-29T07:27:09.012-06:00Comments on Ccna final exam - java, php, javascript, ios, cshap all in one: Is it possible (if so, how) to use jQuery"s appendTo with $.Views?Unknownnoreply@blogger.comBlogger3125tag:blogger.com,1999:blog-865923359735383241.post-39313118034491380822012-02-12T23:59:12.245-07:002012-02-12T23:59:12.245-07:00JavascriptMVC overrides some of jQuery's base ...JavascriptMVC overrides some of jQuery's base methods. One of them is .html, allowing to specify a path to a view instead of the inner html:<br /><br />$("#home").html('//home/home.ejs', {data:data});<br /><br /><br />Now, if you want to append, the .append method is overridden with the same functionality:<br /><br />$("#home").append('//home/home.ejs', {data:data});<br /><br /><br />JSMVC Documentation: http://javascriptmvc.com/docs.html#!jQuery.fn.appendUserhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-10387220380291186682012-02-12T23:59:11.493-07:002012-02-12T23:59:11.493-07:00I found the error. It should have been $.View and ...I found the error. It should have been $.View and not $.Views. But the second way still won't work.<br /><br />//works<br />$( $.View('//home/home.ejs', {data:data}) ).appendTo('#home');<br /><br />//fails<br />$( '//home/home.ejs', {data:data} ).appendTo('#home');Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.comtag:blogger.com,1999:blog-865923359735383241.post-68589379620874661522012-02-12T23:59:10.778-07:002012-02-12T23:59:10.778-07:00I'm not familiar with $.Views but, try this:
...I'm not familiar with $.Views but, try this:<br /><br />$( $.Views('//home/home.ejs', {data:data}) ).appendTo($('#home'));<br /><br /><br />or this:<br /><br />$( '//home/home.ejs', {data:data} ).appendTo($('#home'));<br /><br /><br />when you are calling appendTo, you have to pass a jQuery Selector as the parameter, not only the selector string...Userhttps://www.blogger.com/profile/11557173689529910046noreply@blogger.com