M
M
maiskiykot2019-05-18 20:13:50
Drupal
maiskiykot, 2019-05-18 20:13:50

How to edit ajax output?

I receive data from the parser and write it to the node using Ajax. What is the problem? I'm trying to replace links in the callback function, but nothing happens. What did you do wrong?

function ajax_callback($page_callback_result) {
   // Only render content and validates return
  $content = is_string($page_callback_result) ? $page_callback_result :   drupal_render($page_callback_result);
  $html = '' . drupal_get_css() . drupal_get_js() . '' . $content . '';
 if (!user_is_logged_in()) { // действия, касающиеся авторизованного пользователя
    $html = preg_replace("!<a.*\/?a>!U","Link",$html); 
  }
    print $html;
    drupal_page_footer(); 
}

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