Skip to Content Skip to Menu

CB Content trouble with code - why?

  • mk3
  • mk3
  • OFFLINE
  • Posts: 137
  • Thanks: 2
  • Karma: -1
6 years 9 months ago - 6 years 9 months ago #300499 by mk3
Test messageI'm using CB Content to display input field and apply select2 to it.
In Text I have:
Code:
input id="blabla" type="text" /input

In jQuery I have:
Code:
.......some PHP with SQL code that assigns data to variable $data......... var data = ?php echo $data; ?; $('input#blabla').select2({ data: data });

But each time in Console I have error:
Code:
Uncaught TypeError: jQuery(…).ready is not a function or Uncaught TypeError: jQuery(...).select2 is not a function or Uncaught SyntaxError: Unexpected token <

I suppose it's prohibited to input tags "<" and ">" in jQuery textarea,
but I need to execute my PHP code to put data in var data
How would I make this working?

PS: for now I've found a workaround by creating a PHP file and connecting it in Text textarea of CB Content. Inside I put all my PHP, SQL and JS variable var data:
Code:
script src="/file.php" /script
Last edit: 6 years 9 months ago by mk3.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum