Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9121629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:54:21+00:00 2026-06-17T05:54:21+00:00

using JMVC i have this issue: this line NOT work : this.element.append(‘hello’); here my

  • 0

using JMVC i have this issue: this line NOT work : this.element.append('hello');

here my controller:

steal('jquery/controller', 
    'jquery/dom/form_params',
    'jquery/view/ejs',
    'jquery/controller/view')
.then(
    './home.css',
    function($){
        $.Controller("Wg.Home",

        {
            defaults : {
                defaultText : "Search for things here"
            }
        },

        {


            init : function(){
                this.render();
            },

            render : function(){
                $("body").addClass("home");

                this.rendered = true;
                this.element.html(this.view(this.options));
            this.element.append("<div>Hi there</div>");
            }, ...

i need to manipulate the EJS html after view render but i can’t. what i miss?
Thanks

MORE INFO:

I run my controller from router.js in this way:

this.home = new Wg.Home(this.container);

this.container is :

this.container = $('#page');

and my init.ejs is:

<div class="form-container">
    <form action="" method="get" class="form-wrapper clearfix">

    <input type='text' placeholder="<%=defaultText%>" name='q' id="q" class='blurred'/>
    <button type="submit">Search</button>

    </form>
</div>

I have no error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:54:22+00:00Added an answer on June 17, 2026 at 5:54 am

    Based on the comments below I think to have understood your kind of issue. You’re invoking the view in this way:

     this.element.html(this.view('init',{'artists' : Wg.Models.Artists.findAll()}));
    

    You need to look at this statement ˋWg.Models.Artists.findAll()ˋ. This is nothing else than a wrapper around a jQuery ajax call which is asynchronous. JavaScriptMVC added support for directly handling async ajax calls in the ˋthis.viewˋ method which is done through jQuery Deferreds. That means when you invoke the above instruction, what happens is

    • an asynchronous call to the server starts (defined by ˋWg.Models.Artists.findAll()ˋ)
    • when the result returns, the view (is either taken from local cache or fetched) and rendered with the output.

    The problem however is that ˋthis.element.append(…)’ is done before the ajax call returns, basically your ˋinitˋ view is rendered after your ˋthis.element.append(…)ˋ happens.

    What you could try is to do the following:

    var self = this;
    Wg.Models.Artists.findAll({}, function(data) {
        //this is the success callback when the data has been fetched
        self.element.html(this.view('init', { artists: data }));
        self.element.append('<div>hi there</div>');
    });
    

    Try if that works for you.

    //Edit:

    This article from the docs might be quite helpful:

    • http://javascriptmvc.com/docs.html#!view.deferreds
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using RestKit 0.10.1, I have objects served similar to this json format: {objects: [
Using rubular.com as a guide, I am trying to get this expression to work
Using ember 1.0.0-pre3 I have a little app that has this code: window.App =
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using CI for the first time and i'm smashing my head with this seemingly
Using range() in Underscore I can make something like this: _.range(10); >> [0, 1,
Using getDefinitionByName I am consistently getting the error saying it is not defined (as
Using the example here as a starting point, I set out to customize my
Using this code, the following execution yields strange results: C 100 R W The
using xmltextreader, how would I load a hashtable. XML: <base><user name=john>2342343</user><user name=mark>239099393</user></base> This was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.