-
-
Save jmkelly/1280038 to your computer and use it in GitHub Desktop.
Tinyweb handling ajax post (not working)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Web; | |
using tinyweb.framework; | |
using tinyweb.viewengine.spark; | |
using System.Text; | |
namespace Web.Handlers | |
{ | |
public class IssueHandler | |
{ | |
public IResult Post(IList<String> Issues){ | |
string result = ""; | |
foreach (string str in Issues) | |
result += str + "/n"; | |
return Result.String(result); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Post Demo</title> | |
</head> | |
<body> | |
<input id="button" type="button" value="button"/> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> | |
<script> | |
$(document).ready(function(){ | |
var Issues = {"Issues":[{"string":"a string"},{"string":"another string"}]} | |
$("#button").click(function(event){ | |
$.ajax({ | |
type: "POST", | |
url: "Issue", | |
data: Issues, | |
success: function(msg){ | |
alert( msg ); | |
} | |
}); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment