Guest User

Untitled

a guest
Jun 4th, 2020
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. //php часть 1
  2. go('confirm');
  3.  
  4. // php часть 2
  5. function go($url){
  6.   exit('{"redirect" : "'.$url.'"}');
  7. }
  8.  
  9.  
  10. // js часть
  11. // AJAX Запросс пережача данных на go.form
  12. function post_query(url, name, data)
  13. {
  14.  
  15.   var str = '';
  16.  
  17.   $.each(data.split('.'), function(k, v) {
  18.     str += '&'+ v + '=' + $('#' + v).val();
  19.   } );
  20.  
  21.  
  22.   $.ajax(
  23.   {
  24.     url: '/' + url,
  25.     type: 'POST',
  26.     data: name + '_f=1' + str,
  27.     cache: false,
  28.     success: function(result) {
  29.  
  30.       obj = jQuery.parseJSON(result);
  31.  
  32.       if(obj.go) go(obj.go);
  33.       else alert(obj.message);      
  34.     }
  35.   });
  36. }
  37.  
  38. function go(url) {
  39.   window.location.href='/' + url;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment