Skip to content

Instantly share code, notes, and snippets.

@alfredfrancis
Created May 20, 2017 04:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alfredfrancis/5c28bbb018693a206f4be3912611f037 to your computer and use it in GitHub Desktop.
Save alfredfrancis/5c28bbb018693a206f4be3912611f037 to your computer and use it in GitHub Desktop.
Use jquery to insert and commit json document to solr
<!DOCTYPE html>
<svg width="960" height="500"></svg>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
var jsonData = JSON.stringify([{
"starttime": "2010-10-07T15:56:23.477Z",
"functionid": "476",
"userid": "roney"
}]);
$.ajax({
type : "POST",
url : "http://127.0.0.1:8014/solr/usage_statistics/update/json",
data : {
"stream.body":jsonData
},
dataType : "application/json",
complete : function(msg) {
console.log("finished");
console.log(msg.responseText);
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment