-
Posts
783 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
-
Location
Earth
Q695's Achievements
Advanced Member (4/5)
2
Reputation
-
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
-
How to make a request to plop into a modal with AJAX
Q695 replied to Q695's topic in Javascript Help
If I do that, I need a way to also search with JavaScript turned off. -
How to make a request to plop into a modal with AJAX
Q695 replied to Q695's topic in Javascript Help
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. -
How to make a request to plop into a modal with AJAX
Q695 replied to Q695's topic in Javascript Help
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' -
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.
-
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.
- 1 reply
-
- jquery
- autocomplete
-
(and 2 more)
Tagged with:
-
target is a variable, not a constant, so i can't put it in quotes.
-
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.
-
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>
-
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>
-
my function works, but they're suggesting improvements to it.