bob_the _builder
Members-
Posts
206 -
Joined
-
Last visited
Everything posted by bob_the _builder
-
Worked great thanks.. So with the get method.. I think I have got the following code correct?.. but I can figure out how to access it via a link method? <script type="text/javascript"> $(document).ready(function(){ $("#clickme").click(function () { $("#content").html('Retrieving...'); $.ajax({ type:"GET", data:{ "fname":"12345","lname":"test" }, url: "jqueryresponce.php", success: function(msg){ $("#content").html(msg) } } ); }); }); </script> Thanks
-
Hi, Whats the correct way to add more post fields into: data: "data=" + $("#data").val()&"data2=" + $("#data2").val(), Thanks
-
Hey, From my understanding this should work.. SELECT * FROM timeslots WHERE timeslot = NOW(DATE_ADD(timeslot, INTERVAL 1 DAY)) But it returns no rows and no errors.. Is there a problem with the fact the field is formated DATE/TIME aposed to DATE? Thanks
-
Hi, How can I check mysql date/time field for all records with tommorows date.. ? Thanks
-
Hey, I am using the following code to crop photos.. But I would like to crop the from the center out aposed to from the top left corner.. How can I do that? // Crop Thumbs $width = 70; $height = 70; $dimensions = getimagesize($images_dir."/tb_".$filename); $canvas = imagecreatetruecolor($width,$height); $piece = imagecreatefromjpeg($images_dir."/tb_".$filename); $newwidth = 70; $newheight = 70; $cropLeft = ($newwidth/ 2) - ($width/ 2); $cropHeight = ($newheight/ 2) - ($height/ 2); imagecopyresized($canvas, $piece, 0,0, $cropLeft, $cropHeight, $width, $height, $newwidth, $newheight); if (imagejpeg($canvas,$images_dir."/tb_".$filename,100)) { echo 'Image crop successful'; } else { echo 'Image crop failed'; } imagedestroy($canvas); imagedestroy($piece); Thanks
-
Hi, I have made a script to email newsletter to subscribers.. is there a way to check if email address exist, if it doesnt remove the record from the database? Also a way to mark the email as read in the database? Cheers
-
Hi, Using: <form name="record" method="get" onSubmit="AjaxRequest("main","./includes/billing.php?action=records");"> to the following javascript for ajax: function AjaxRequest(target_div,file,check_div) { var MyHttpRequest = false; var MyHttpLoading = '<table width="100%" border="0" bgcolor="#FFFFFF" height="209"><tr><td align="center" valign="middle"><img src="./loading.gif"></td></tr></table>'; var ErrorMSG = 'Sorry - No XMLHTTP support in your browser, buy a newspaper instead'; if(check_div) { var check_value = document.getElementById(check_div).value; } else { var check_value = ''; } if(window.XMLHttpRequest) { try { MyHttpRequest = new XMLHttpRequest(); } catch(e) { MyHttpRequest = false; } } else if(window.ActiveXObject) { try { MyHttpRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { MyHttpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { MyHttpRequest = false; } } } else { MyHttpRequest = false; } if(MyHttpRequest) { var random = Math.random() * Date.parse(new Date()); var file_array = file.split('.'); if(file_array[1] == 'php') { var query_string = '?rand=' + random; } else if(file_array[1] == 'htm' || file_array[1] == 'html') { var query_string = ''; } else { var query_string = check_value + '&rand=' + random; } MyHttpRequest.open("get", url_encode(file + query_string), true); MyHttpRequest.onreadystatechange = function () { if(MyHttpRequest.readyState == 4) { document.getElementById(target_div).innerHTML = MyHttpRequest.responseText; } else { document.getElementById(target_div).innerHTML = MyHttpLoading; } } MyHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); MyHttpRequest.send(null); } else { document.getElementById(target_div).innerHTML = ErrorMSG; } } But it doesnt seem to work, how can I submit a form to it using GET method? Thanks
-
What? Web Host Manager
-
Hi, I want to write a simple billing script for webhosting accounts. Is it posible to read the user information out of WHM? I assume its stored in mysql database somewhere? Thanks
-
Hi, I believe it does.. Thanks
-
Hi, I have a client that has got a merchant account via their bank.. Their online store was sending customers to paypal to complete the transactions, but now they are insisting to have the transaction taken direct from their site putting the money directly into their bank account.. and if not for filled they take their business else where Where would I start to figure this option out and write the code to make it happen. Thanks
-
Hey Not sure thats the answer.. I am trying to link from one page to another page.. the other page I am linking to contains the div tag and the ajax script. Is there away to link from one page to the other exicuting the ajax and loading the records from the $_GET value sent from the previous page? Thanks
-
Hi, I normally use a link like below to have data change within ajax script. href=\"javascript: AjaxRequest('menu','./includes/eventlist.php?eventdates=".$link_date."')\" How can I link from other pages to the page holding the div tag and have it query for the records I need dependant on the external link? Thanks
-
Wow that worked.. Didnt think the letter case made any difference. Thanks
-
No prompts at all.. Odd, The code is in the head tags, and removed from the body onLoad.
-
Hi, Yes sorry about that, tried to remove the solved but it didnt and asumed people wouldnt take notice being marked. Nothing loads, as if the onLoad doesnt exist... Thanks
-
Hi Is there any obvious reason the code above wouldnt work, as it works fine using onload in the body tag..? Seems to look fine Thanks
-
oh thats simple .. Thank you
-
Hi, Is there another way to replace the following code breaking it from the body tag? onLoad="AjaxRequest('main','./includes/eventdisplay.php?id=0');AjaxRequest('menu','./includes/eventlist.php?id=0')" Thanks
-
Hi, Ajax? function AjaxRequest(target_div,file,check_div) { var MyHttpRequest = false; var MyHttpLoading = '<table height="238" width="100%" border="0"><tr><td align="center" valign="middle"><img src="./loading.gif"></td></tr></table>'; var ErrorMSG = 'Sorry - No XMLHTTP support in your browser, buy a newspaper instead'; if(check_div) { var check_value = document.getElementById(check_div).value; } else { var check_value = ''; } if(window.XMLHttpRequest) { try { MyHttpRequest = new XMLHttpRequest(); } catch(e) { MyHttpRequest = false; } } else if(window.ActiveXObject) { try { MyHttpRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { MyHttpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { MyHttpRequest = false; } } } else { MyHttpRequest = false; } if(MyHttpRequest) { var random = Math.random() * Date.parse(new Date()); var file_array = file.split('.'); if(file_array[1] == 'php') { var query_string = '?rand=' + random; } else if(file_array[1] == 'htm' || file_array[1] == 'html') { var query_string = ''; } else { var query_string = check_value + '&rand=' + random; } MyHttpRequest.open("get", url_encode(file + query_string), true); MyHttpRequest.onreadystatechange = function () { if(MyHttpRequest.readyState == 4) { document.getElementById(target_div).innerHTML = MyHttpRequest.responseText; } else { document.getElementById(target_div).innerHTML = MyHttpLoading; } } MyHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); MyHttpRequest.send(null); } else { document.getElementById(target_div).innerHTML = ErrorMSG; } } As it stands I can submit links ($_GET) data and have it query the database and bring back the results within the div tags, but I cant make data sent within a form query the database and bring back results within the div tag.. Thanks
-
Hey, I want to submit the form and have it process the php script within the div tag. As you would using the get method within a link like: <a href=\"javascript: AjaxRequest('main','".$_SERVER['PHP_SELF']."?action= Thanks
-
Hey, Using the code from sticky "AJAX - a basic start and working example" how can you send post data into the div tags? I have it working ok for all links that are text base but cant manage to post form data and load in the div tag. Thanks
-
Hi, Its the same result.. Only processes the one variable.. OnSubmit="javascript: AjaxRequest(\'main\',\'./includes/gallery.php?action=addsubcat&subcatname=\',\'subcatname\')" No data is picked up for the other variable maincatid Thanks
-
Hi, Like so? } else { document.getElementById(target_div).innerHTML = MyHttpLoading; // still working } } MyHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); MyHttpRequest.send(null); } else { document.getElementById(target_div).innerHTML = ErrorMSG; // the browser was unable to create a httprequest }
-
function MyAjaxRequest(target_div,file,check_div) { var MyHttpRequest = false; var MyHttpLoading = '<p>Loading...</p>'; // or use an animated gif instead: var MyHttpLoading = '<img src="loading.gif" border="0" alt="running" />'; var ErrorMSG = 'Sorry - No XMLHTTP support in your browser, buy a newspaper instead'; if(check_div) { var check_value = document.getElementById(check_div).value; } else { var check_value = ''; } if(window.XMLHttpRequest) // client use Firefox, Opera etc - Non Microsoft product { try { MyHttpRequest = new XMLHttpRequest(); } catch(e) { MyHttpRequest = false; } } else if(window.ActiveXObject) // client use Internet Explorer { try { MyHttpRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { MyHttpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { MyHttpRequest = false; } } } else { MyHttpRequest = false; } if(MyHttpRequest) // browser supports httprequest { var random = Math.random() * Date.parse(new Date()); // make a random string to prevent caching var file_array = file.split('.'); // prepare to check if we have a query string or a html/htm file if(file_array[1] == 'php') // no query string, just calling a php file { var query_string = '?rand=' + random; } else if(file_array[1] == 'htm' || file_array[1] == 'html') // calling a htm or html file { var query_string = ''; } else // we have presumable a php file with a query string attached { var query_string = check_value + '&rand=' + random; } MyHttpRequest.open("get", url_encode(file + query_string), true); // <-- run the httprequest using GET // handle the httprequest MyHttpRequest.onreadystatechange = function () { if(MyHttpRequest.readyState == 4) // done and responded { document.getElementById(target_div).innerHTML = MyHttpRequest.responseText; // display result } else { document.getElementById(target_div).innerHTML = MyHttpLoading; // still working } } MyHttpRequest.send(null); } else { document.getElementById(target_div).innerHTML = ErrorMSG; // the browser was unable to create a httprequest } }