0

I'm working in a page of Wordpress that reload the post showed in one DIV. The reload comes from the click in any post of the list under this DIV.

All is working fine but the problem is that i want to mantain friendly url's of Wordpress, and AJAX needs to send data in an url.

In frontend:

<div id="<?php the_ID(); ?>" onClick="inlove_ajax(this.id); return false">

In AJAX file:

xmlhttp.open("GET","wp-content/themes/37504/ajax_photo_reload.php?q="+str,true);

In PHP (ajax_photo_reload.php):

          require_once("../../../wp-blog-header.php"); 
          $q=$_GET["q"]; 
          query_posts('p='.$q); 
          while (have_posts()) : the_post(); 

I was thinking and trying different solutions:

  • Add an exception in .htacces for these file
  • Some way to send data with friendly urls
tshepang
  • 12,111
  • 21
  • 91
  • 136

2 Answers2

0

For an AJAX request, there's no need to mantain friendly URLs, since they are not visible to the user (nor are they to search engines). You should use a format that is easy to parse, just as normal GET parameters are.

nibra
  • 3,958
  • 2
  • 20
  • 34
0

Reading your post, let me please advice you two things:

I am here to provide with support. Good luck

Community
  • 1
  • 1
Adib Aroui
  • 4,981
  • 5
  • 42
  • 94
  • Good info, thanks! I use these info to rewrite my code, and it works, but happens exactly the same, without friendly urs works, with firnedly works can't pass data in url and doesn't work – Santi Gómez Apr 08 '13 at 17:50
  • i dont understand you well; but if you use my advice, you will gain in terms of security: it is anyway a major issue. feedback to me when you resolve the friendly url problem so that i learn from your experience – Adib Aroui Apr 09 '13 at 03:56
  • I solved. Writing in this line the right path it rules alone: url: 'wp-content/themes/twentyten/pages/next-previous.php?p='+id, – Santi Gómez Apr 22 '13 at 20:10