48 lines
1.3 KiB
HTML
48 lines
1.3 KiB
HTML
<!DOCTYPE>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>New Paste</title>
|
|
<script type="text/javascript" src="/js/jquery.js"></script>
|
|
</head>
|
|
<body>
|
|
<div>
|
|
<p>Page Title: <input id="share_title" type="text" name="title" size=80> </p>
|
|
<p>Paste Your Code Here: </p>
|
|
<p><textarea id="share_code" name="code" rows=20 cols=80></textarea></p>
|
|
<p><input id="submit" type="submit" value="Paste!"></p>
|
|
<p id="result"></p>
|
|
</div>
|
|
|
|
<script>
|
|
$("#submit").click(function(){
|
|
$("#submit").attr({disabled:"disabled"});
|
|
$("#result").text("Submitting...");
|
|
console.log("Clicked!");
|
|
titleval=$("#share_title").val();
|
|
codeval=$("#share_code").val();
|
|
console.log("Begin post");
|
|
$.post("/cgi-bin/doPaste",{title:titleval,code:codeval},function(data){
|
|
console.log("Receive Reply");
|
|
// Enable Button
|
|
$("#submit").removeAttr("disabled");
|
|
|
|
if(data.success==1)
|
|
{
|
|
$("#result").text("Submitted! Redirecting...");
|
|
location.href=data.next_url;
|
|
}
|
|
else
|
|
{
|
|
$("#result").text("Failed to Submit. Service Error ("+err.status+" "+err.statusText+")");
|
|
}
|
|
},'json').fail(function(err){ /// jQuery.post(...).error(...) is removed. Use fail(...) instead.
|
|
// Enable Button
|
|
$("#submit").removeAttr("disabled");
|
|
$("#result").text("Failed to Submit. General Error ("+err.status+" "+err.statusText+")");
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|