<html>
<script src="json.js";/>
<script src = "jquery.js"/>
<script type="text/javascript">
function PopulateBlendSpecification() {
var data = new Object();
data.Message = "message";
alert(JSON.stringify(data));
$.ajax({
url: "Test.aspx/Test",
type: "POST",
contentType: "application/json;charset=utf-8",
dataType: "json",
data: JSON.stringify(data),
success: function (result) {
var listItems = [];
var blendSpecItems = JSON.parse(result.d);
for (var key in blendSpecItems) {
listItems.push('<option value="' + blendSpecItems[key].BlendSpecID + '">' + blendSpecItems[key].BlendName
+ '</option>');
}
var lBox = $('select[id$=lbBlendSpecs]');
$(lBox).append(listItems.join(''));
}
})
}
Test.aspx.cs
[WebMethod()]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static string Test(string message)
{
return message;
}
This works fine when I try this within one project. However, when I move the webmethod into a separate prjoject within the same solution I get an ajax error:
Error in: http://localhost/Test/MyWebService/Test.asmx/Test
error: undefined
type: ajaxError
readystate: 4
status: 500