ajax - This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. -
i want take both 'blog entry' , 'blog entry photo' controller ajax. when taking 'blogentry' there isnt problem ,on other hand, when taking both of them (blogentry , blogentryphoto), there problem: "this request has been blocked because sensitive information disclosed third party web sites when used in request. allow requests, set jsonrequestbehavior allowget."
i think problem in 'blog entry photo' because has photopath column "/content/img/blog/25052017_2334_400x400.jpg". used jsonresult doesnt work
return json(new { success = true, blogentries = blogentries, blogentryphotos = blogentryphotos}, jsonrequestbehavior.allowget);
what should do?
finally, solved issue arising photopath data. first, @ controller, data of both blogentry , blogentryphotos serailized @ view data parsed object.
controller
list<blogentry> blogentries = _blogentryrepo.getall(x => x.isactive.value && x.placemarkerid == placemarker.id, null, "blogentryphotoes").tolist(); jsonserializersettings jss = new jsonserializersettings { referenceloophandling = referenceloophandling.ignore }; return json(new { success = true, blogentries = jsonconvert.serializeobject(blogentries, formatting.indented, jss) }, jsonrequestbehavior.allowget);
view
$.ajax({ url: "/map/getblogentries", type: "post", datatype: "json", data: placemarker, success: function (response) { if (response.success) { var blogentries = json.parse( response.blogentries ); //blogentries[i].title can used //blogentries[i].blogentryphotoes[0].photopath can used } else { //do } }, error: function (xhr, status) { //do } });
Comments
Post a Comment