如何从ApiControler获取图像 [英] how to get images from ApiControler

查看:85
本文介绍了如何从ApiControler获取图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个模型和一个视图,并使用简单的GameController从模型中显示了一些所需的数据。



现在我正在搜索(没有找到任何有用的东西) )如何使用ApiController获取9个图像并在页面中显示它们(9个可用于拼图的图像)并修改GameController返回的页面,而不加载整个页面。



我的想法是,我想从ApiController调用该方法9次,并在网格/表格或某处显示图像。



我可以使用一个如何做到这一点的例子,因为我没有在谷歌上找到相关内容,有知识的人可以非常快地完成。



如果有什么不清楚的话,请问。



谢谢,

Gabriel Sas

I have created a model and a view and displayed some needed data from the model using simple GameController.

Now i am searching(didn't found anything usefull) on how to get 9 images and show them in the page using ApiController(9 images that can be used for a puzzle) and modifying the page that GameController has returned, without loading the whole page.

The idea is that i want to call the method from ApiController 9 times and to show the images in a grid/table or somewhere.

I can use an example on how to do this since i didn't found something relevant on google and someone with knowledge can do it very fast.

If something is unclear, just ask.

Thanks,
Gabriel Sas

推荐答案

你应该尝试使用ajax从控制器调用图像:



http://stackoverflow.com/questions/11215303/retrieve-images-from-database-through-a-jquery-ajax-call [ ^ ]



简单地说,使用
You should try using ajax to call images from controller:

http://stackoverflow.com/questions/11215303/retrieve-images-from-database-through-a-jquery-ajax-call[^]

simply put, use


.ajax来获取您的图像并更新您的页面。



这是你应该做的,但由于你自己没有发布任何代码,我很难继续。
.ajax to get your image(s) and update your page.

That is what you should do but as you have not posted any code yourself it is hard for me to continue.


你也可以查看这篇文章:

http://www.codeguru.com/csharp/.net/returning-images-from-asp.net-web-api.htm [ ^ ]
You can also check out this article:
http://www.codeguru.com/csharp/.net/returning-images-from-asp.net-web-api.htm[^]


这篇关于如何从ApiControler获取图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆