如何使用javascript从数据库获取imagepath及其名称 [英] How to get imagepath and its name from database using javascript

查看:84
本文介绍了如何使用javascript从数据库获取imagepath及其名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
谁能给我一个编码或参考,以使用javascript ...从数据库中获取imagepath及其名称...


问候
vivek

Hi all,
Can anyone give me a codings or reference to get imagepath and its name from database using javascript...


Regards
vivek

推荐答案

您可以使用JQuery向Web服务器发出Ajax请求,例如:
You can use JQuery to do an Ajax request to the web server, like:


.ajax({ url:" , 类型:" , 数据 { imageId: 1234 }, 成功:功能(结果){
.ajax({ url: "ImageRetriever.java", type: "GET", data { imageId: 1234 }, success: function(result) {


(" #imagePath").text(result); } });
("#imagePath").text(result); } });



然后,在服务器端,您有一个Java servlet/PHP脚本/C#类,它获取图像ID,使用该ID查询数据库,并返回图像路径.现在,我也将发布它,但是没有更多细节(您的服务器端语言,数据库的外观等),我无法做到,因为我基本上是盲目的



And then, in the server side, you have a Java servlet / PHP script / C# class that gets the image id, queries the database using that id, and returns the image path. Now, I would post this as well, but without further details (your server side language, how the database looks like, etc) I can''t do that, as I''m basically blind


这篇关于如何使用javascript从数据库获取imagepath及其名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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