common.js 454 B

123456789101112131415161718192021222324252627282930
  1. function failure(data) {
  2. console.log(data);
  3. alert(data.message);
  4. }
  5. function splitValue(str, split) {
  6. var s = ',';
  7. if (split) {
  8. s = '' + split;
  9. }
  10. if (str) {
  11. if (str.length > 0) {
  12. return str.split(s);
  13. }
  14. }
  15. return [];
  16. }
  17. function joinValue(o, split) {
  18. var s = ',';
  19. if (split) {
  20. s = '' + split;
  21. }
  22. if (o) {
  23. if (toString.apply(o) === '[object Array]') {
  24. return o.join(s);
  25. }
  26. }
  27. return o;
  28. }