中国开发网: 论坛: Delphi/BCB: 贴子 1000991
pcplayer:WebBroker and jquery ajax
Delphi WebBroker and jquery AJAX

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">


<script src="../js/jquery.min.js"></script>

<script>

$(function(){


// This jquery function can get image src string from server and show image.
$.get("titlepic?imgNo=1", function(data,status){
$('#img1').attr("src", data);


}

);
})
</script>



<title> </title>

</head>

<body>



<div id="banner">
<img src="../1.jpg" / class="banner-img">
</div>




<div class="thumbnail">
<img id="img1" class="title-img" />


</div>

</body>

</html>


--------------------
WebBroker code:

procedure TWebModule1.WebModule1WebActionTitlepicAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
Id, PicName: string;
i: Integer;
begin
Id := Request.QueryFields.Values['ImgNo'];

i := 0;
TryStrToInt(Id, i);
case i of
0: PicName := '0.jpg';;
1: PicName := '2.jpg';
2: PicName := '3.jpg';
3: PicName := '4.jpg';
4: PicName := '5.jpg';
end;

Response.Content := FUploadImagePath + PicName;
end;

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录