Jump to content

jl5501

Members
  • Posts

    728
  • Joined

  • Last visited

    Never

Everything posted by jl5501

  1. I am missing some probably trivial understanding regarding when jquery code can be called, and would like some pointers please. the particular example happens to be for a slideshow, but could be any other jquery functionality. So I have this situation where the normal call is on ready like this <script type="text/javascript"> function onBefore() { $('#output').html("Scrolling image:<br>" + this.src); } function onAfter() { $('#output').html("Scroll complete for:<br>" + this.src) .append('<h3>' + this.alt + '</h3>'); } $(document).ready(function() { $('.slideshow').cycle({ fx: 'scrollLeft', timeout: 5000, before : onBefore, after : onAfter }); }); </script> I have included the 2 callback functions there but they are not relevant to my question particularly Ok that works perfectly and all occurs as it should What I actually want is the on ready function to call a getContent() function that loads content to the page and then calls the jquery all works in terms of the content load, but the jquery call produces an error so I am obviously calling it incorrectly my ready function just does this and works correctly <script type="text/javascript"> $(document).ready(function(){ http = getHTTPObject(); http2 = getHTTPObject(); loadContent(); }); </script> the loadContent calls my serverside code by ajax correctly ( no particular reason not to use jquery ajax), but after the call I wish to initiate the slideshow so it looks like this function initSS() { alert('starting'); alert('here'); alert($('.slideshow').length); $('.slideshow').cycle({ fx: 'scrollLeft', timeout: 5000, before : onBefore, after : onAfter }); alert('done'); } function showContent() { if(http.readyState == 4) { alert(http.responseText); eval(http.responseText); initSS(); } } function loadContent() { var url='loadindexcontent.php'; //alert(url); http.open("GET",url, true); http.onreadystatechange=showContent; http.send(null); } the content loads perfectly, just the jquery fails any help would be greatly appreciated John
  2. Ok, you can see from your query that fleetref has no value, so it does not have a record to update
  3. I cannot see where the $account variable is coming from which decides if the update loop is ever executed.
  4. Can you show the form area, where the POST data is coming from for the update query
  5. You would need to store the original GET name/values as hidden fields in the second form, which would then be alongside the form values when submitted. Incidently, you could use POST for the second form in this case, and your original GET values will be part of the POST data
  6. Hello You may find this useful echo date('l dS \o\f F Y h:i:s A', strtotime('last thursday')); Where you can add/remove specifiers in the date() function to change how the date is displayed
  7. The mysql engine will always return 0 affected rows if nothing has been changed. You need to check for an error in the query or do some other validation rather than rely on affected rows.
  8. you do not want (0) as that turns off error reporting, but you need it as the first line of your script. <?php error_reporting(E_ALL); ini_set("display_errors", 1); ?>
  9. The blank page is likely to be a syntax error of some sort. You need to turn error reporting on for this page to see what php is complaining about. http://php.net/manual/en/function.error-reporting.php
  10. Assuming your $reg and $email variables exist, and have values compatible with the types of the table elements of the same name, and you have $_GET['reg'] then there should not be a problem
  11. What code are you executing after setting up that query variable? Are you connecting to a database? what code is returning the error?
  12. the urlencode() function should provide what you need
  13. If you test by sending it to a page that you have control over, then, as you are sending by POST, you will see it in the $_POST superglobal, so print_r($_POST) will show your data.
  14. I notice there is a typo in my code in the spelling of category that might be the issue
  15. it needs to be where you have your curl_exec as it calls curl_exec so goes instead of the straight call
  16. try adding this if(curl_exec($ch) === false) { echo 'Curl error: ' . curl_error($ch); } else { echo 'Operation completed without any errors'; }
  17. The first point is that I would assume that your receiving application will require the POST data to be in a variable=value format so your post data would need to be in the form of : $post_data = 'xml_data = '.$xml_data; and then pass that through curl. To execute that with an onclick event, you have basically 2 choices. 1) have the code in a separate file that you redirect to with your onclick, which is a bit clunky. 2) have the code in a separate file that is called from an ajax function tied to your onclick, which could then return any messages into an element on your page to indicate the result.
  18. Hi This page may help you. It is using POST data from a form, but the principle is the same as you need. http://www.askapache.com/htaccess/sending-post-form-data-with-php-curl.html
  19. You will either need a web services library, or will need to use cURL to make the call
  20. I would insert a space before the - so it is clearly seen as a minus
  21. Some thing like this if($dh = opendir($dir)) { $last_cat = ''; $files = Array(); $inner_files = Array(); while($file = readdir($dh)) { if($file != "." && $file != ".." && $file[0] != '.') { if(is_dir($dir . "/" . $file)) { if($last_cat != $categpry[$file]) { echo "<h2>$category[$file]</h2><p>"; $last_cat = $category[$file]; } $inner_files = ListFiles($dir . "/" . $file); if(is_array($inner_files)) $files = array_merge($files, $inner_files); } else { array_push($files, $dir . "/" . $file); } } } closedir($dh); return $files; }
  22. You mention looking for names like pic1.jpg and pic2.jpg. In your code comment you give an example of picture1.jpg Are you sure the filenames you are trying to delete are exactly correct.
  23. If you make an attempt to code what you want, then post that here, then someone will help you correct your mistakes.
  24. The php mail() function only knows if the mail has been successfully queued by the local mail handler. It does not get to know anything regarding the actual delivery.
  25. You have not shown where your $row array comes from. If you can show that, then we may be able to help.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.