Reputation: 1740
I am using the following code
function test()
{
GetAttributesForSelectedControlType('Phone Number');
}
function GetAttributesForSelectedControlType(questionType) {
alert(questionType);
$.ajax({
url: '/Wizards/GetAttributesForSelectedControlType/' + questionType,
type: "GET",
contentType: "application/json",
success: function (result) {
alert('success');
}
});
}
PLEASE NOTE: QUESTIONTYPE is a STRING value and not any type..
The issue is that in the controller, I m getting a hit on "GetAttributesForSelectedControlType"
function but the parameter value is coming null.
I am sending string in questionType
.
any ideas on this?
Upvotes: 0
Views: 973
Reputation: 12437
Try:
function GetAttributesForSelectedControlType(questionType) {
$.get('/Wizards/GetAttributesForSelectedControlType', {questionType: questionType })
.done(function(data) {
alert('success');
});
}
You need to pass in questionType
as a data. Alternatively you could just add the follwoing into your existing ajax call.
data: {questionType: questionType }
This will work with the following action:
public ActionResult GetAttributesForSelectedControlType(string questionType)
{
// ...
}
Upvotes: 0
Reputation: 154
function GetAttributesForSelectedControlType(questionType) {
alert(questionType);
$.ajax({
url: '/Wizards/GetAttributesForSelectedControlType',
contentType: "application/json",
data: {
questionType: questionType
},
success: function (result) {
alert('success');
}
});
}
Upvotes: 1
Reputation: 315
if you are looking to pass question type as an argument you should use data:{qType:questionType}
this will fill the argument qType of the function GetAttributesForSelectedControlType
Upvotes: 0