0
버튼이있는 간단한 부트 스트랩 페이지가 있으며 버튼을 클릭하면 모달이 열립니다.Json과 부트 스트랩이있는 WCF
질문은 모달 콘텐츠 또는 모달 몸체가 wcf 데이터로 채워 져야합니다. 웹 페이지와 wcf json 데이터 모두 IIS에서 호스팅됩니다.이 작업을 수행하는 방법을 알려 주실 수 있습니까? 사전에
덕분에 enter image description here
버튼이있는 간단한 부트 스트랩 페이지가 있으며 버튼을 클릭하면 모달이 열립니다.Json과 부트 스트랩이있는 WCF
질문은 모달 콘텐츠 또는 모달 몸체가 wcf 데이터로 채워 져야합니다. 웹 페이지와 wcf json 데이터 모두 IIS에서 호스팅됩니다.이 작업을 수행하는 방법을 알려 주실 수 있습니까? 사전에
덕분에 enter image description here
당신이해야 할 것은 WCF 메서드를 호출 JQuery와의 아약스 전화를 확인하는 것입니다. 다음은 귀하가 서비스에 전화하는 방법입니다.
var Type;
var Url;
var Data;
var ContentType;
var DataType;
var ProcessData;
function WCFJSON() {
var userid = "1";
Type = "POST";
Url = "Service.svc/GetUser";
Data = '{"Id": "' + userid + '"}';
ContentType = "application/json; charset=utf-8";
DataType = "json"; varProcessData = true;
CallService();
}
// Function to call WCF Service
function CallService() {
$.ajax({
type: Type, //GET or POST or PUT or DELETE verb
url: Url, // Location of the service
data: Data, //Data sent to server
contentType: ContentType, // content type sent to server
dataType: DataType, //Expected data format from server
processdata: ProcessData, //True or False
success: function(msg) {//On Successfull service call
ServiceSucceeded(msg);
},
error: ServiceFailed// When Service call fails
});
}
function ServiceSucceeded(result) {
if (DataType == "json") {
$("#ModalBody").html(result)
}
고맙습니다. 최고의 설명 코드입니다. – Harsha