csrftoken.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /**
  2. * Created by xiaofeng on 2017/8/9.
  3. */
  4. csrfToken = $('meta[name=csrf-token]').prop('content');
  5. function ReturnInfo(info) {
  6. if(info != null){
  7. var strmsg = '';
  8. if(typeof info == 'string'){
  9. return info;
  10. }
  11. $.each(info,function (kk,vv) {
  12. strmsg +=vv[0]+'<br>';
  13. })
  14. if(typeof strmsg == 'string'){
  15. return strmsg;
  16. }
  17. }
  18. }
  19. //价格转换
  20. function house_price($a,$b) {
  21. if($a == '' || $a == 0 || $a == null){
  22. return '待定';
  23. }else{
  24. return $a+'<i>'+$b+'</i>';
  25. }
  26. }
  27. //转换楼盘没有的数据
  28. function house_params($a) {
  29. if($a == '' || $a == 0 || $a == null){
  30. return '暂无数据';
  31. }
  32. return $a;
  33. }
  34. var feng_cityTel;
  35. $('.y_call').click(function(){
  36. var y_call=$('#feng_citytel').text();
  37. if (typeof y_call === 'string' && y_call != '') {
  38. return window.location.href = 'tel:'+y_call;
  39. }
  40. $.ajax({
  41. url:'/index/telrand',
  42. dataType:"json",
  43. type:'POST',
  44. data:{city:feng_cityTel,csrf_token_m:csrfToken},
  45. success:function(data){
  46. if(data.code == 200){
  47. return window.location.href = 'tel:'+data.data.tel;
  48. }
  49. },
  50. error:function(){
  51. }
  52. });
  53. })
  54. $(function(){
  55. // ������һ��������
  56. $('.y_lpleft').on('click',function(){
  57. history.back(-1);
  58. })
  59. })
  60. //获取GET请求参数
  61. function getUrlParams(url) {
  62. var theRequest = new Object();
  63. if (!url)
  64. url = location.href;
  65. if (url.indexOf("?") !== -1)
  66. {
  67. var str = url.substr(url.indexOf("?") + 1) + "&";
  68. var strs = str.split("&");
  69. for (var i = 0; i < strs.length - 1; i++)
  70. {
  71. var key = strs[i].substring(0, strs[i].indexOf("="));
  72. var val = strs[i].substring(strs[i].indexOf("=") + 1);
  73. theRequest[key] = val;
  74. }
  75. }
  76. return theRequest;
  77. }