Jump to content

A few general AJAX questions


Prodigal Son

Recommended Posts

Ok, so I have a page that has a smaller section called comments that is wrapped around a div. This comment section is an include file that has the php code to display the comments. When people post a comment, AJAX will call the include file and post the response in the div. So basically its replacing the old comments by reloading all the comments plus the new comment. Is this the right way to do it? The problem I have is that I block people from seeing my include files, but if I do this then AJAX isn't able to call that page. Instead I make that include viewable, however, people can now type the URL in their browser and see the blank page (or maybe some errors if error reporting is on), is this any sort of security concern? Is there a way to make it so that people can't view the page and have it still work with AJAX?

 

Another question I have is regarding the pagination I have for the comments part. Clicking to go to any page uses AJAX to include the comment include again with the variable to show which page. There is no problem with this, however if you click the pages like a madman, Firefox eventually gives an uncaught exemption error. Wait about 10 seconds and it will work again. It doesn't seem to happen in other browsers. Is this a common occurrence? I have tried searching around about this, and most of the times its due to people calling files from outside their domain, but that is not the case here. I'm on my localhost with relative paths if that matters any.

 

Last question is for an anchor tag I use javascript:; as the href and then have an onclick that calls the AJAX function. Doing this, you won't be able to open it in a new window, is there a way to fix that?

 

Thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.