I want to build-up ajax based friends system. though i no nothing about ajax:sick: (would like to learn but) actually i have form where user can add his friend. on very next page of this page he/she can see what he/she is entered and where
they should probably see the add and remove button(which i want to build up using ajax)
can any one know how to start for this? till now i have code where user can write his friend name and to the next page he/she can see the value he has written. on submit button it all goes in to database. means i have devloped php form for this.if anyone want to see it please let me know.
i will go through the book.but i didnt find any similar code for my form. could you please give me similar code(similar links) which i want to build up?
just wanted to ask this.can we actually do this.because i have been searching a lot related to this topic but couldn’t able to find out related to my query
generaly i found related links using php/ajax/mysql
two select data
other html application like showing images and all
Here’s an example script that’s used on a photography website so a user can review photos online then check/uncheck a checkbox for which photos (s)he wishes to select.
function flipState (el) {
if (el.checked) {
el.checked = false;
} else {
el.checked = true;
}
}
function flipCheckBox (cb) {
nm = cb.name;
var tcb = nm.substring (nm.indexOf ('_') + 1, nm.length);
if (nm.indexOf ('b_') > 0) {
var ncb = 'cbl_' + tcb;
}
if (nm.indexOf ('bl_') > 0) {
var ncb = 'cb_' + tcb;
}
el = xGetElementById (ncb);
flipState (el);
tcb = tcb.substring (5, tcb.length);
updateSelections (<?php echo $_SESSION['TempID'] ?>, <?php echo $pid ?>, tcb);
}
function updateSelections (cid, pid, tcb) {
var xmlHttp;
var resp = '';
try {
// Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
}
catch (e) {
// Internet Explorer
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
alert ('Your browser does not handle the photo selection process');
return false;
}
}
}
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
resp = xmlHttp.responseText;
if (resp != 'OK') {
alert ('There was a problem recording your photo selection request.');
}
}
}
// Send the info to the PHP handler page
var data = 'updatephototemptable.php?cid=' + cid + '&pid=' + pid + '&tcb=' + tcb;
xmlHttp.open ("GET",data,true);
xmlHttp.send (null);
}
The above code is called from the checkbox like so …