Faster Lookup code
Faster Lookup code
Perhaps more JS than jQuery but looking for a faster option than a long if else statement code. Perhaps easier to manage.
I have a menu system which depending on the ID if the list item clicked calls a ajax page.
Here's how I'm managing it now
Is there a way I can do it where I just maintain an index of ID's and pages?
$
(
document
).
ready
(
function
() {
$
(
".menu-li"
).
click
(
function
(
e
){
if
(
$
(
this
).
attr
(
"id"
) ==
'my-btn'
){
$
.
ajax
({
url:
"page-content/mypage.php"
,
success
:
function
(
result
){
$
(
"#main-bdy"
).
html
(
result
);
}});
Topic Participants
bevan
jakecigar