Page 1 of 1

echo using jquery

Posted: Tue May 17, 2011 11:49 am
by ashwood
I was wondering how i would go about doing this:

basically i want to echo out my results from a table but i want to use jquery as i want to be able to put a x button on each results then if that is clicked the results i removed from the page and also from the database i was thinking delete from the database and on delete refresh div that all the results are echo'd out into? does that make sence?

thanks
ash :)

Re: echo using jquery

Posted: Tue May 17, 2011 2:08 pm
by jacek
The fact that you are using JavaScript to add some kind of page effect means nothing.

You can still output data from the database with php,

Re: echo using jquery

Posted: Tue May 17, 2011 2:42 pm
by ashwood
yeah i know that.. its the fact when i press delete i want it to disapear like fadeout effect type thing..

Re: echo using jquery

Posted: Tue May 17, 2011 3:05 pm
by jacek
So the problem is using the fade method ?

What are you having trouble with ?

I am the wrong person to ask on jQuery things, but I will have a go ;)

Re: echo using jquery

Posted: Tue May 17, 2011 10:17 pm
by ashwood
basically right i want to echo out the results like i currently am in php BUT if the user i admin i on hover a delete button will appear i can do that the show if admin the show on hover i cant not yet.. but the main thing is when that delete button is pressed i want that result to fade out and the other results to close in together as to say that result never existed but at the same time as fading out delete that record from the database...

Re: echo using jquery

Posted: Wed May 18, 2011 12:13 am
by jacek
ashwood wrote:but at the same time as fading out delete that record from the database...
That would ave to be done via an ajax request, I have no idea on all the visual stuff, but to make it remove from the db you want to use AJAX :D

Probably want to create a function that does the ajax request, and then shows an error if it fails, or removes the item if not.
function remove_item(item_id){
    // do things
}
Then this function should be called using the onclick event for the X button or what ever you have,

Re: echo using jquery

Posted: Fri May 20, 2011 10:31 am
by ashwood
jacek wrote:
ashwood wrote:but at the same time as fading out delete that record from the database...
That would ave to be done via an ajax request, I have no idea on all the visual stuff, but to make it remove from the db you want to use AJAX :D

Probably want to create a function that does the ajax request, and then shows an error if it fails, or removes the item if not.
function remove_item(item_id){
    // do things
}
Then this function should be called using the onclick event for the X button or what ever you have,


see now i can work with the above and do the fading myself using jquery I THINK its a long shot but im going to have a go.. in that function you provided //do things.. could i not get it to call a php file that has the delete from... in it?

Re: echo using jquery

Posted: Fri May 20, 2011 3:14 pm
by jacek
ashwood wrote:in that function you provided //do things.. could i not get it to call a php file that has the delete from... in it?
That's what I meant by things ;)

Re: echo using jquery

Posted: Fri May 20, 2011 8:30 pm
by ashwood
jacek wrote:
ashwood wrote:in that function you provided //do things.. could i not get it to call a php file that has the delete from... in it?
That's what I meant by things ;)
should be fairly easy now then :) thanks man