title: jqGrid binary img wont show up
body: <p>I use a standard function to retrieve an image within the system, as we have the binary in the database, this works good throughout the whole system.  </p>
  
  <p>Currently implementing jqGrid and have some issues to use the current structure as images don't show up and the jquery structure (<code>$obj = $("&lt;div&gt;");</code>) is not useable.</p>
  
  <p>Now I try to implement to get the binary image, however it won't show up, when using a static url it works and image data is being retrieved.</p>
  
  <pre><code> $.extend($.fn.fmatter, {
              getBinairy: function (cellValue, options) {
                  //var object = $();
                  var width = 50;
                  var html = "";
                  getImage(cellValue).success(function (data) {
                      $.each($.parseJSON(data.d), function (idx, obj) {
                          p_image = obj.img;
                          p_type = obj.type;
                          p_width = obj.width;
                          p_height = obj.height;
                      });
                      var _width = width / p_width;
                      var _height = _width * p_height;
                      html = "&lt;img src='data:" + p_type + ";base64," + p_image + "' /&gt;";
  
                      //object = $("&lt;img/&gt;", {
                      //    src: "data:" + p_type + ";base64," + p_image,
                      //    width: width,
                      //    height: _height
                      //});
                      //object.append($img);
                  });
                  //var html = "&lt;img src='img/test/20131027_132450.jpg' /&gt;";
                  return html;
              },
  </code></pre>
  
  <p>As far I think the fn is loading the "html" too fast, I can't understand other reason, however have no idea how to avoid this.</p>
  
  <p>Any help?</p>
  
  <p>---UPDATE---</p>
  
  <pre><code> var ip = "";
              var station = "";
              return $.ajax({
                  type: "POST",
                  url: "services/general.asmx/SendBinairy",
                  data: JSON.stringify({ session: 'ed6d1cc6-82f9-46e8-91bb-eae341a771cf', ip: ip, station: station, id: id }), ///, _filter: JSON.stringify(_json) }),
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  loaderror: function (xhr, status, error) {
                  },
                  success: function (data) { }
              });
  </code></pre>
  
  <p>---UPDATE---</p>
  
  <pre><code>"dataset": [
    {
      "id": 5,
      "suffix_type_id": 0,
      "sexe_type_id": 1146,
      "first_name": "Varvara",
      "middle_name": "",
      "last_name": "D",
      "full_name": "Varvara D",
      "company_name": "",
      "nickname": "",
      "birthday": "1983-12-18",
      "age": 31,
      "language_type_id": 6,
      "relation_type_id": 0,
      "job_status_type_id": 404,
      "nationality_type_id": 0,
      "last_online": "",
      "last_online_app_id": 0,
      "profile_image": 24,
      "profile_rating": 7.000,
      "number_contacts": 0,
      "number_applications": 0,
      "address_id": 0,
      "address_1": null,
      "address_2": null,
      "address_3": null,
      "number": 0,
      "add": null,
      "postal_code": null,
      "city": null,
      "city_type_id": 0,
      "latitude": null,
      "longitude": null,
      "state": null,
      "state_type_id": 0,
      "country_type_id": 0,
      "address_type_id": 0,
      "image": [
        {
          "file_id": 24,
          "binary": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIB
  </code></pre>
  
  <p>And this is how I add the data to the jqGrid</p>
  
  <pre><code>$("#" + grid_id).jqGrid({
                                          loadonce: true,
                                          type: "POST",
                                          url: "services/general.asmx/HelloWorld",
                                          postData: { q: session },
                                          datastr: colD,
                                          contentType: "application/json; charset=utf-8",
                                          datatype: "jsonstring",
                                          colModel: colM,
                                          rowNum: 10,
                                          rowList: [10, 20, 30],
                                          pager: '#' + grid_id,
                                          sortname: 'id',
                                          viewrecords: true,
                                          sortorder: "desc",
  </code></pre>