Jump to content

Q695

Members
  • Posts

    783
  • Joined

  • Last visited

Everything posted by Q695

  1. I tried assigning variable names first, but for some reason I was unable to get it process, so I decided to try with ? to get them to run. Can you provide a run-able example?
  2. Going from something like: $sql_update=''; $binders=''; if(isset($_POST['name']) && $_POST['name']!=''){ $name=$_POST['name']; $binders.=",$name"; $sql_update.="`name`=?"; } ... if(isset($_POST['phone']) && $_POST['phone']!=''){ $phone=$_POST['phone']; $binders.=",$phone"; $sql_update.="`phone`=?"; } $binders = trim($binders, ','); $sql_update = trim($sql_update, ','); if ($sql_update!='' && $binders!='') { $sql = "UPDATE ___table___ SET $sql_update WHERE id=$___id___"; $q = $conn->prepare($sql); // $q->execute(array($binders,$___id___)); } How would you send it to the PDO function? I spent the whole day trying to convert it from a mysql statement to a PDO statement, and feel like
  3. If I do that, I need a way to also search with JavaScript turned off.
  4. When I put the run_modal( href, url_data ) inside the jquery function() it says: Uncaught Reference Error: run_modal is not defined when outside It says: Uncaught Error: cannot call methods on dialog prior to initialization; attempted to call method 'open' when I remove the return false the hyperlink behaves as it always has. I'm just trying to be able to pass the function variables in through the "old method" to make the function more understandable (maybe I need to see a video on how exactly the jquery variable system works). vision: you have X possible modals that can be triggered you're trying to only trigger 1 modal that will use the variables it receives to run its ajax lookup.
  5. This would work, if I wasn't trying to run a modal instead of an alert for presentation reasons: https://jqueryui.com/dialog/#modal-form The error I'm getting is: Uncaught Error: cannot call methods on dialog prior to initialization; attempted to call method 'open'
  6. Here's what I'm starting with: javascript: $(function() { $( "#dialog" ).dialog({ autoOpen: false }); }); function run_modal( href, url_data ) { // $("#dialog").dialog("open"); $( "#dialog" ).dialog( "open" ); alert(href+"?"+url_data); } PHP: echo " <div id='dialog' title='Blog Post Viewer'></div> "; function modalize($link_txt, $href, $url_data){ //<a href='?$url_data' onmousedown='run_modal()' onclick='return false' >$link_txt</a> echo " <a href='? $url_data ' onclick='return false' onmousedown=' run_modal ( \" $href \" , \" $url_data \" );'> $link_txt </a> "; } I'm struggling to make the modal popup. From there I plan to plug in my own generic ajax loader to request the data to be populated in the modal.
  7. I'm struggling to produce results to the screen from the following code: HTML: <script src="http://code.jquery.com/jquery-2.1.4.js"></script> <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <script src="../scripts/autocomplete.js"></script> <div> <input type='text' class='search_input' name='search' id='search' placeholder='search' autofocus onkeypress='search_func("http://webfarm.io/subs/homefront/list_articles.php" , "search_output")'> <div id='search_output' class='search_output'></div> </div> Javascript: function search_func( href , target){ var search = $("#search").val(); search = $.trim(search); if(search){ $.ajax({ method: "POST", url: href , data: { search: search } }) .done(function( msg ) { target.innerHTML = msg; // as above, data holds the result of the request, so all the data returned from your results.php file are in this param but please see below; console.log(msg); }); } else { target.innerHTML = ''; } } What am I doing wrong? Why won't it produce the desired results? Sorry if I'm looking like a help vamp, but I'm not trying to be.
  8. I'm trying to build a facebook login for part of my php page, and was wondering if you can help me get the session creation setup? When I go to the login view it doesn't allow you me to run it as anything, but don't see how to setup the login with session[] stuff.
  9. swapcontent() is a page content swapper like in frames, which are now dead.
  10. target is a variable, not a constant, so i can't put it in quotes.
  11. Yes, it works until I run swapContent(). No, just a single run, not whenever found on the page through soft refresh. I solved it temporarily with a hard refresh just for that page. I'm asking why it only triggers once on the page in the jquery forum: https://forum.jquery.com/topic/errors-between-ajax-and-accordian It could be a bigger problem than just accordion.
  12. this is my jquery imports: <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  13. Here's the example of what I have for compliant code: <div id="accordion"> <h3></h3> <div> </div> <h3></h3> <div> </div> <h3></h3> <div> </div> <h3></h3> <div> </div> <h3></h3> <div> </div> </div>
  14. my function works, but they're suggesting improvements to it.
  15. if it's correct, why doesn't it run every time you click the load statement, and has static html in it?
  16. i knew that already, i was hoping that maxxd would be able to advise me on what i missed.
  17. It responds with the proper html, which I knew from part 1 it was the proper from going down this path. I know narrowed it down to the accordion call of: $(function() { $( "#accordion" ).accordion({ collapsible: true, active: false, heightStyle: "content" }); console.log('ran'); });
  18. It could be your host, unless it's your own hosting service.
  19. The code you suggested I use broke, so I'm now trying to go from: function swapContent(href, url_data, target) { $.ajax({ type:'get', url:href, beforeSend:function(){ target.innerHTML="Doing something - please wait."; }, data:url_data, }).done(function(ajaxObject){ var resp = JSON.parse(ajaxObject); if(resp.success == true){ target.innerHTML="Woot!"; }else{ target.innerHTML='Processing error - system returned false!'; } }).error(function(){ target.innerHTML='System error - not processing related!'; }); } The error I get is "Uncaught SyntaxError: Unexpected token <" crashed on: Doing something - please wait. Your $('#target') it didn't run.
  20. I use this for my ajax ATM: function swapContent(href, url_data, target) { $.ajax({ type: 'GET', cache: false, url: href+'?' + url_data, //add a variable to the URL that will carry the value in your i counter through to the PHP page so it know's if this is new or additional data success: function (data) { // this param name was confusing, I have changed it to the "normal" name to make it clear that it contains the data returned from the request //load more data to "target" value div target.innerHTML = (data); // as above, data holds the result of the request, so all the data returned from your results.php file are in this param but please see below } }) }
  21. soft refresh (ajax call) is like a soft start on a computer (software reset) hard refresh (f5) is like a hard refresh on a computer (shut down, and power on again) The error is the accordion breaks, so it's an id10t error, not a syntax error.
  22. How do you solve an error where a soft refresh of data causes an accordion to fail, but on a hard refresh it works just fine? example: $(function() { $( "#accordion" ).accordion({ collapsible: true, active: false, heightStyle: "content" }); console.log('ran'); });
  23. Look into: http://www.w3schools.com/php/func_string_str_replace.asp
×
×
  • 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.