It's a trap
It's a trap

Reputation: 1353

Jquery get Request Uri too long

I have a project which is built on ASP.NET MVC. There is a database table to store user's details including image, an api to output his details and view where i consume the api by ajax call. My api is returning the base64 value of image perfectly, but a 404 error comes saying request uri too long when i try to display the image.

Relevant lines of code are

$.ajax({
url: // url of api,
type: "GET",
success: function (data) {
var preview = document.querySelector('img');
preview.src = data.Image;
}
})

Upvotes: 2

Views: 3441

Answers (1)

Mattias Åslund
Mattias Åslund

Reputation: 3907

Does your base64-string start with data:image/png;base64,? Look here for complete example.

Upvotes: 4

Related Questions