peuge Posted July 16, 2008 Share Posted July 16, 2008 Wassup all, So im completely new to AJAX but am really keen to get started! I have been reading forums, tutorials etc... I have the following question: echo '<a class="menuhref" href="index.php?choice=3&&category=' . $url . '" target="_parent">' . $i . '</a>'; All the tutorials I have been reading are about passing form data, is it possible to pass url data like above using AJAX? Thanks in adavance!!! Link to comment https://forums.phpfreaks.com/topic/115025-implementing-ajax-with-url-data/ Share on other sites More sharing options...
xtopolis Posted July 16, 2008 Share Posted July 16, 2008 Yes, but not in that way. You want that link to call a function, not be a link. From your function you would add the necessary params to the url (choice=, category=) etc. Since that is a $_GET query, it's relatively easy, and your tutorials should show you how. But remember, AJAX performs stuff in the background and returns results, rather than actively moving the user to a new page, as your <a> tag currently does. <?php echo '<a class="menuhref" href="#" onclick="someFunction(\'3\',\''.$url.'\')">'.$i.'</a>'; ?> That would pass 2 arguments to someFunction which could then do what you wanted and send back to results (for you to place appropriately with javascript) Link to comment https://forums.phpfreaks.com/topic/115025-implementing-ajax-with-url-data/#findComment-591989 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.