0

I am trying to integrate popup plugin from https://github.com/webtechnick/CakePHP-Popup-Plugin. I just followed exactly as said on the above link. I am trying to load a element in popup hence i used this $this->Popup->link('click me', array('element' => 'my_element')); but when i load on the browser i get this following error which i have no clue about it and i have been trying to fix this for last two days and pls help me resolve this error

SyntaxError: illegal character
...eldset>\r\n\t<a href=\"#\" onclick=\"$('#popup_1').show(); return false;\">click...

and any other possible solution to this would be appriciated.

learner
  • 1,041
  • 3
  • 15
  • 31
  • What's in `app/views/elements/my_element.ctp`? I see some backslashes in the output that probably shouldn't be there... Is it possible you've used a single-quoted string somewhere that you meant to use a double quoted string? – DaveRandom Jan 29 '14 at 12:41
  • i have created a signup form in myelement.ctp – learner Jan 29 '14 at 13:14
  • well I will suggest use simplest popup instead of plugin, see http://webdesignandsuch.com/how-to-create-a-popup-with-css-and-javascript/ in this if want help I can help you – Anubhav Jan 29 '14 at 15:10
  • @Anubhav thanks i would need ur help... – learner Jan 30 '14 at 05:23

1 Answers1

0

Ok then see how implement webdesignandsuch.com/how-to-create-a-popup-with-css-and-javascript/

Now read the implementation from the above link, now what you have to do in cakephp is given below:

Step 1: Add these two lines in your layout file, lets say you are using default layout then inside body tags add:

 <div id="blanket" style="display:none"></div>
 <div id="popUpDiv" style="display:none">

These two lines will be used to create popup div and blanket

Step 2: Now You will see css-pop.js file there is one function

  function popup(windowname) {
         blanket_size(windowname);
         window_pos(windowname);
         toggle('blanket');
         toggle(windowname);        
  }

So you have to make one ajax request to get HTML of popup as example is shown below

$.ajax({
      url: "test.html",
         context: document.body
     }).done(function(data) {
      $('#popUpDiv').html(data);
      popup('popUpDiv');
     });

data would be html code which is a response of your ajax request.

Step 3: Create url of ajax request, lets sat ajax_signup.html

   echo all the html part followed by exit.

Now you get an idea what I am trying to explain!

Anubhav
  • 1,605
  • 4
  • 18
  • 31