index.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <style>
  2. .css-input {
  3. margin-bottom: 0;
  4. text-shadow: 0px 0px 0px rgba(42, 42, 42, .75);
  5. text-align: left;
  6. border-radius: 8px;
  7. border-width: 3px;
  8. border-style: solid;
  9. background-color: #ffffff;
  10. border-color: #419fd1;
  11. box-shadow: -7px 0px 10px 0px rgba(7, 76, 214, .0);
  12. font-weight: normal;
  13. font-family: sans-serif;
  14. font-size: 16px;
  15. width: 500px
  16. }
  17. .css-input:focus {
  18. outline: none;
  19. }
  20. .btn {
  21. display: inline-block;
  22. padding: 6px 12px;
  23. margin-bottom: 0;
  24. font-size: 14px;
  25. font-weight: 400;
  26. line-height: 1.42857143;
  27. text-align: center;
  28. white-space: nowrap;
  29. vertical-align: middle;
  30. -ms-touch-action: manipulation;
  31. touch-action: manipulation;
  32. cursor: pointer;
  33. -webkit-user-select: none;
  34. -moz-user-select: none;
  35. -ms-user-select: none;
  36. user-select: none;
  37. background-image: none;
  38. border: 1px solid transparent;
  39. border-radius: 4px;
  40. color: #fff;
  41. background-color: #337ab7;
  42. border-color: #2e6da4;
  43. margin-left: 10px;
  44. }
  45. #resdiv {
  46. margin: 15px 0;
  47. }
  48. </style>
  49. <script type="text/javascript">
  50. $(document).ready(function () {
  51. $("#button").click(function () {
  52. if($("#url").val() == '') return false;
  53. $.ajax({
  54. //cache: true,
  55. type: "POST",
  56. url: 'u/u2s.php',//提交的URL
  57. data: $('#shorturl').serialize(), // 要提交的表单,必须使用name属性
  58. //async: false,
  59. success: function (data) {
  60. var parsedJson = jQuery.parseJSON(data);
  61. if(parsedJson.status == 1){
  62. var msg = parsedJson.url
  63. }else if(parsedJson.status == 0){
  64. msg = parsedJson.msg
  65. }
  66. $("#res").val(msg);
  67. },
  68. error: function (request) {
  69. alert("Connection error");
  70. }
  71. });
  72. return false;
  73. });
  74. });
  75. </script>
  76. <p>请输入需要转换的网址(如 https://www.solomp.com),务必添加<b>http</b>或<b>https</b>前缀<p>
  77. <div id="urlform">
  78. <form id="shorturl" action method="POST">
  79. <input type="text" id="url" name="url" class="css-input">
  80. <button class="btn" id="button">提交</button>
  81. </form>
  82. </div>
  83. <div id="resdiv">
  84. <input id="res" readonly="true" placeholder="输出结果" />
  85. </div>