Skip to content

Instantly share code, notes, and snippets.

@jmkelly
Created October 12, 2011 02:08
Show Gist options
  • Save jmkelly/1280038 to your computer and use it in GitHub Desktop.
Save jmkelly/1280038 to your computer and use it in GitHub Desktop.
Tinyweb handling ajax post (not working)
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);
}
}
}
<!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