TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kranthi Vardhan Kolluru
956
512
48.7k
Return webmethod data in javascript function return value
Dec 19 2019 11:39 PM
Hi,
i am developing a page in asp .net with javascript webmethod.
the webmethod is returing good data.
I have a functions.js file in that file i worte a function.
function
getQData(ostrAgency, oSurID, oHIEPriv, oIsChecked)
{
//debugger;
var
strData;
var
params =
"{'strAgency':'"
+ ostrAgency +
"', 'strSurID':'"
+ oSurID +
"', 'strHIEPriv':'"
+ oHIEPriv +
"','IsChecked':'"
+ oIsChecked +
"'}"
;
$.ajax({
type:
"POST"
,
url:
"Rpt.aspx/getQuesData"
,
contentType:
"application/json; charset=utf-8"
,
data: params,
dataType:
"json"
,
success:
function
(responce) {
if
(responce.d !=
''
) {
strData = responce.d;
return
strData;
}
},
failure:
function
(responce) {
debugger
;
alert(responce.d);
},
error:
function
(response) {
debugger
;
alert(responce.d);
}
});
return
strData;
}
i am calling this getQData method in frontend as
$(document).ready(
function
() {
event.preventDefault();
LoadQuesData();
});
function
LoadQuesData() {
var
ostrAgency =
""
;
var
oSurID = GetParameterValues(
'surID'
);
var
oHIEPriv =
'<%=Session["HIEPRIV"]%>'
;
var
oIsChecked =
false
;
if
($(
'#cntMain_rdoAgency'
).is(
':checked'
)) {
// strAgency = $('#ddlmasterAgency option:selected').text();
ostrAgency = $(
'#ddlmasterAgency option:selected'
).val();
oIsChecked =
true
;
}
debugger
;
var
strData1 =getQData(ostrAgency, oSurID, oHIEPriv, oIsChecked);
if
(strData1 !=
""
) {
var
otblTopQuestions = $(
"#tblTopQuestions"
);
var
strHTML =
""
;
var
slno = 0;
$.each(JSON.parse(strData1),
function
(index, value) {
// debugger;
slno++;
strHTML +=
'
+ value.QUES_ID +
'" type="checkbox" checked="checked" data-id='
+ value.SQM_ID +
'> Q'
+ slno +
' '
+ value.SQM_QUES_DESC +
''
;
});
otblTopQuestions.append(strHTML);
}
}
in strData1 i am not getting the data. any help..???
Reply
Answers (
6
)
In CAST, How to fix Avoid Artifact's with High Fan-Out
i have an issue in email scheduling in web application