mardi 15 mars 2016

Error displaying data handlebars-js

I'm trying to access the id of this element sent by json in handlebars.js

{
    "status":"success",
    "message": {
        "message":"sdasdasasd",
        "type":"photo",
        "post_id":55,
        "title":"",
        "description":"",
        "url":"",
        "image":"",
        "code":"",
        "provider":"",
        "photo": {
           "http:\/\/timeline.dev\/storage\/app\/public\/vdjkelly\/timeline_SzfkoDzMWc.jpg":"http:\/\/timeline.dev\/storage\/app\/public\/vdjkelly\/timeline_SzfkoDzMWc.jpg",
           "http:\/\/timeline.dev\/storage\/app\/public\/vdjkelly\/timeline_qm7sq7RY1K.jpg":"http:\/\/timeline.dev\/storage\/app\/public\/vdjkelly\/timeline_qm7sq7RY1K.jpg"
        }
    }
}

The code I have so

@{{#each photo}}

  <li class="grid">
    <div class="posted-photo">
      <div class="photo">
        <div class="fphoto-item">
          <a class="ShowStatus" data-id="@{{post_id}}" href="#" data-lightbox="lightbox@{{post_id}}">
            <img src="@{{this}}" class="imgpreview" id="@{{post_id}}" rel="@{{post_id}}">
          </a>
        </div>
      </div>
  </li>
@{{/each}}

and still no access to me id post

My js code is as follows:

var template = render_template('#send-photo', {
    'message': response.message.message, 
    'type': response.message.type, 
    'photo': response.message.photo, 
    'post_id': response.message.post_id
});



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire