javascript - Jquery ajax POST php session to determine active page -


I am running CakePHP 2.5.X and we have CMS setup where the page administrator can be created, and after that For related navigation, I have also added the option of setup pages as a link, so we do not have duplicate content / pages. We have found this problem that if we make a page (A) as a parent , Then one parent with another parent page (B) Do not create the page (C) which is the parent material belongs with, then the same page (D) content but set a URL variable so that the navigation system C.

Example HIL:

  and lt; Ul class = "nav" & gt; & Lt; Li Data-id = "1" & gt; & Lt; A href = "/ a" & gt; A & lt; Ul & gt; & Lt; Li Data-id = "2" parent-page = "1" & gt; & Lt; A href = "/ c" & gt; C & lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; Li Data-id = "3" & gt; & Lt; A href = "/ b" & gt; B & lt; Ul & gt; & Lt; Li Data-id = "4" original page = "3" & gt; & Lt; A href = "/ c" & gt; D & lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; / Ul & gt;  

Issue, when D is clicked, you are sent to Page C, which again activates the parent page A. To prevent this and to ensure that the B and D remain active link (class = "active"), I have used jquery and AJAX to post to a php script, which is then the page id In the session that I can read, load the page and set the active page to active. Although it does not seem to work, I have no problem in Chrome, its Firefox, IE, Safari, etc. are giving me problems. Basically this does not work or only partial works.

  $ ("ul.child li a"). Click (function () {$ .ajax ({type: 'POST', url: "/ user / set session /", data: {current_page_id: $ (this) .Parent (). Attr ('data-id' ), Page_parent_id: $ (this) .parent () .ttr ('page-parent')}}. (Function (msg) {& lt ?? php if ($ this-> session- & gt; check ('User.User.id') == 1) {? & Gt; Alert (msg); & lt;?}? & Gt;});});  

Does anyone have any ideas or other solutions? In the end we have decided to duplicate pages with different names and only one non- The index is not ashamed that we have not been able to work on Chrome in any browser.


Comments