Using jquery to add to model

2 posts, 0 answers
  1. Rich
    Rich avatar
    22 posts
    Member since:
    Feb 2012

    Posted 27 Sep 2013 Link to this post

    Not sure this is the right forum for this but here goes. I have a mobile app that gets an image via the camera. It puts the contents of the image into the variable 'imageData' I then use jquery:
    $('#smallImage').attr('src', "data:image/jpeg;base64," + imageData);
    into the image:
    <img id="smallImage" width="100%" data-bind="attr: { src: Robot.Picture }">
    that works fine as far as display goes. It does not however add it to "Robot"

    I am using jaydata to save the data to a local database and the model has a lot of fields (all text inputs) and they all data-bind fine. 

    Any ideas?
  2. Rich
    Rich avatar
    22 posts
    Member since:
    Feb 2012

    Posted 27 Sep 2013 Link to this post

    It never fails, I post a question then almost immediately I figure it out. I had to push the variable into the model via:
    viewModel.Robot.set('Picture', imageData);
    Added that right before the sync and all was right in my world. Hopefully this might helps someone else.
  3. Kendo UI is VS 2017 Ready
Back to Top