redis_set_get.js 795 B

123456789101112131415161718192021222324252627282930313233
  1. function set_redis(key, value) {
  2. console.log("test")
  3. $.ajax({
  4. type: "POST",
  5. url: "/redis/set/" + key,
  6. data: JSON.stringify({ value: value }),
  7. dataType: "json",
  8. contentType: "json",
  9. success: function(data)
  10. {
  11. (data.GET);
  12. }
  13. });
  14. }
  15. function get_redis(key) {
  16. $.ajax({
  17. type: "GET",
  18. url: "redis/get/" + key,
  19. data: "format=json",
  20. dataType: "text",
  21. success: function(data)
  22. {
  23. $("#result").text(data.GET);
  24. }
  25. });
  26. }
  27. function split_string(string) {
  28. var string = str.split(" ",2);
  29. return string;
  30. };