I'm starting out with jQuery, and as I was trying to implement jQuery
in a simple CMS I made to make the CMS more fancy, I ran into this
problem.

Say I'm having a news page on my website. The CMS displays all news
items that are in the database. The CMS is built using PHP and MySql.
So on that php page all news items are listed. If I want to delete a
news item, I can click the "delete" button next to the news item. This
works in PHP.

Now I want to use jQuery to ajaxify things. If one clicks the delete
button, I want the deletion to happen without a page reload. So I
assume I write a javascript function using jQuery that calls an
external PHP file in which the item gets deleted. But of course that
PHP file needs to know the ID of the news item, to make sure it is
deleting the right item. How do I pass this ID as an argument to the
javascript function?

I'm aware of this:  $.get("test.php", { id: "345", action:
"delete" } );

But I want the values for id and action to be dynamic.

Reply via email to