JQuery: $ .cookie is different than php $ _COOKIE? (web browser only)

I use jQuery to update and load search results and page navigation at the bottom of the page. I have a jQuery slider and several HTML forms with checkboxes, for each of these elements I set a cookie (when changing) and use it .load()to load content from load_search.php, which works very well in all browsers.

Now I use the same method to load page navigation, and I get very strange results. In the search.php file, jQuery code:

// PAGE NAVIGATION //

$('#page_navigation').on("click", ".page_no_item" , function(event) {
      var id = (event.target.id);
      $.cookie("cur_page_no", id);
      search_results_load();
      page_navigation_load();
      alert($.cookie("cur_page_no")); // -> returns the right cookie value
    });

Also, I will check the value on the finished document to make sure:

$(document).ready(function() {  
      alert($.cookie("cur_page_no")); // -> also returns the right cookie value
    });

.php, , no-webkit, $_COOKIE['cur_page_no'] , webkit, 1 ( , Cookie ). var_dump() string(1) "1" webkit.

. localhost, . , cookie (, ), .

! !!:)

+3
1

, , cookie . - php cookie, - javascript cookie. cookie, php , .

, , - cookie "" , . , php late cookie , cookie, $_COOKIE['yourCookieName'] = $val.

, , , , cookie JS PHP , , / update/duplication

+2

All Articles