Reputation: 9979
I am sure i am doing something bad here, but i cannot figure out what.
<script type="text/javascript">
$(function () {
$("li").bind("click", function () {
var sel = $(this).attr('id').toString();
$.ajax({
type: "POST",
contentType: "application/json",
data: sel,
url: "Default.aspx/SaveValue",
dataType: "text",
success: function (data) {
alert(data.d);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
debugger;
}
});
});
});
</script>
Any advises please?
And here is the debug info gathered
UPDATE: By changing to data: "{var1:'test'}",
and dataType: "json",
everything works as expected
Upvotes: 1
Views: 10847
Reputation: 9979
By changing to data: "{var1:'test'}",
and dataType: "json",
everything worked as expected.
Special thanks to Sparky and to all commenters of course
Upvotes: 4