O
O
overim2020-12-09 19:44:47
JavaScript
overim, 2020-12-09 19:44:47

How to correctly form an AJAX request under Fancybox 3?

There is such a function that displays the necessary data in the jqueryui modal window:

function ShowProfile( name, url, allowedit ){
  if (dle_user_profile == name && document.getElementById('dleprofilepopup')) {$('#dleprofilepopup').dialog('open');return false;}
  dle_user_profile = name;
  dle_user_profile_link = url;
  ShowLoading('');
  $.get(dle_root + "engine/ajax/controller.php?mod=profile", { name: name, skin: dle_skin, user_hash: dle_login_hash }, function(data){
    HideLoading('');
    ShowPopupProfile( data, allowedit );
  });
  return false;
};

But I want to remake this window with FancyBox3
plugin Here is my attempt:
function ShowProfile( name, url, allowedit ){
  if (dle_user_profile == name && document.getElementById('dleprofilepopup')) {$('#dleprofilepopup').dialog('open');return false;}
  dle_user_profile = name;
  dle_user_profile_link = url;
  ShowLoading('');
  $.get(dle_root + "engine/ajax/controller.php?mod=profile", { name: name, skin: dle_skin, user_hash: dle_login_hash }, function(data){
    HideLoading('');
    
    $.fancybox.open({
       src: "data",
       type: "ajax",
       ajax: {
           settings: {
               type: "POST",
               data: {
                   name: name,
                   myparam2: "value2"
               }
           }
        }
    });
  });
  return false;
};

But for some reason it loads in the window the entire page on which I am, instead of the data transmitted by the php file
How to adapt this request correctly?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question