vendredi 14 septembre 2018

mark.js function is not working when i pass a json.stringifyed object as an argumet

the mark.js is imported , it is working when the argument is hard coded anywhere with a string argument , ajax is returning success , the items from the data base are imported and everything is ok except that it is not marking anything :

here is the mark function :

  var mark = function (wordobj) {
            $(".context").mark(wordobj);
        };

here is the ajax/jquery retrieving items from the data base and succeeding :

            $.ajax({

                type: "POST",
                  url: "tooltipmark.aspx/Getwordsfromdb",
                  data: "{'g' : '" + 1 + "'}",
                  dataType: "json",
                  contentType: "application/json; charset=utf-8",
                  success: function (res) {
                      alert("success");

                      $.each(res.d, function (index, value) {
                          console.log(JSON.stringify(value.Word));
                          var tobemarked = JSON.stringify(value.Word);
                          mark(tobemarked);

                      });

                  },

                error: function (xhr, textStatus, err) {
                    alert("readyState: " + xhr.readyState);
                 }

            });

console loging the values is loging the words perfectly




Aucun commentaire:

Enregistrer un commentaire