d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Jquery-ajax-php? > 2nd Set Eyes Appreciated. Low Priority.
Add Reply New Topic New Poll
Member
Posts: 1,849
Joined: May 31 2008
Gold: 2,571.50
Nov 22 2015 04:42pm
So created a TODO list for class.

I started off with this:
https://jsfiddle.net/xz9c8L6j/
Notice how when the trash can button is clicked my event handler triggers.

The above was my "start", getting ready to add ajax.
Note: Instructor gave us php files to work with. I have no experience with php until today.

This is my new code using ajax requests to populate list items.
https://jsfiddle.net/meohy5kg/

EDIT: Problem statement = event click listener not working for trash button.

So when I render the page it populates the list items with contents from the database like so:


In my console I have this error
Code
not well-formed
which happens 5 times. Once for each list item.

I've tried to add in my the javascripts on ready one non database element (like the first jsfiddle link), but the onclick for that item also doesn't work.

I've been playing around with finding the issue for quite some time, time for a 2nd set of eyes.

It's not a big deal I guess. I'll be asking my teacher tomorrow if I can't figure it out, but it's one of those things that bugs you until you fix it. So any help is appreciated!

Thanks for your time.

This post was edited by Noobtard on Nov 22 2015 04:44pm
Member
Posts: 1,849
Joined: May 31 2008
Gold: 2,571.50
Nov 23 2015 10:33pm
:locked:

So at school had someone look at it. The problem was that since ajax is asynchronous my on clicks are being added before my initial populate finishes.

So basically had to setup on click listeners after db calls.

I also noticed I posted this in java and not the web sub-directory mb.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll