xeonman13 — 2013-04-25T22:14:42-04:00 — #1
I am creating an admin backend for a site.
This admin backend will add instructors.
I need to have the ability to assign the instructors to several categories. So far easY? Multiple select field.
Here is where i am stuck.
I need a nice way of adding new categories on the fly without refreshing entire page.
Anyone know of any ajax, jqueryui or tutorial on how to accomplish this using PHP/MYSQL values that populate the categories field?
starlion — 2013-04-26T08:49:04-04:00 — #2
So you're looking at this from the Admin user's POV.
The user is looking at an Instructor Edit page.
You have a multiple select field (box).
You need to add a new item to the select field box. So you need a separate form/lone input box with a button next to it that says "Add Category".
Server takes in Category Name, spits out Category ID and Name again.
AJAX handler processes return, appends element to the list.
1: Forming the AJAX request
2: The PHP to receive the AJAX request and return the reponse
3: The line of jQuery needed to add the category to the box
Show us what you've done, and we can try and point you in the right direction.
xeonman13 — 2013-04-29T08:05:43-04:00 — #3
Thanks for your response.
Im having an issue with all 3.
I am not good with AJAX, so I was looking to see if anyone knew of a solution that exists with documentation on how to install.
starlion — 2013-04-30T15:14:57-04:00 — #4
Basic AJAX example: http://www.w3schools.com/ajax/tryit.asp?filename=tryajax_first
Basic AJAX tutorial: http://www.w3schools.com/ajax/default.asp
(This covers #1; #2 you should be able to do)
jQuery to append a category to a multi-select: $("#catSelect").append('<option value="1">My option</option>');