Jump to content

Search the Community

Showing results for tags 'jquery'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. I'm trying to refresh a data input into an INPUT through a form and then SUBMIT this to the database to return it as a table on the same page. I want it to do this without showing the refresh of the page. This is what I have currently. When I put data into any of the INPUT fields and click SUBMIT nothing happens and nothing shows for an error. <?php session_start(); error_reporting (E_ALL); require '../core/cnn.php'; if(isset($_POST['submitsearchprojno'])) { $searchprojno = $_POST["searchprojno"]; } if(isset($_POST['submitsearchadd'])) { $searchaddress = $_POST["searchaddress"]; } if(isset($_POST['submitsearchpc'])) { $searchpostcode = $_POST["searchpostcode"]; } $searchpostcode = mysql_real_escape_string($searchpostcode); $searchaddress = mysql_real_escape_string($searchaddress); $searchprojno = mysql_real_escape_string($searchprojno); ?> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> <h4 class="modal-title">Search Projects</h4> </div> <div class="modal-body"> <form class="modal-form" id="searchform" name="searchform" action="" method="post"> <div class="form-group"> <label class="col-md-4 control-label">Project Number</label> <div class="col-md-6"> <input type="text" class="form-control input-inline input-medium" name="searchprojno" id="searchprojno" placeholder="Enter Project Number"> </div> <button type="submit" class="btn blue" id="submitsearchprojno" name="submitsearchprojno" >Search <i class="m-icon-swapright m-icon-white"></i></button> </div> <div class="form-group"> <label class="col-md-4 control-label">Address</label> <div class="col-md-6"> <input type="text" class="form-control input-inline input-medium" name="searchaddress" id="searchaddress" placeholder="Enter Address"> </div> <button type="submit" class="btn blue" id="submitsearchadd" name="submitsearchadd" >Search <i class="m-icon-swapright m-icon-white"></i></button> </div> <div class="form-group"> <label class="col-md-4 control-label">Postcode</label> <div class="col-md-6"> <input type="text" class="form-control input-inline input-medium" name="searchpostcode" id="searchpostcode" placeholder="Enter Postcode"> </div> <button type="submit" class="btn blue" id="submitsearchpc" name="submitsearchpc" >Search <i class="m-icon-swapright m-icon-white"></i></button> </div> <div class="form-group"> <div class="col-md-12"> <div class="table-responsive"> <table class="table table-striped table-bordered table-advance table-hover"> <thead> <tr> <th class="col-md-9"><i class="fa fa-list-alt"></i> Address</th> <th class="col-md-3"></th> </tr> </thead> <tbody> <tr> <?php $searchrs = mysql_query("SELECT ProjectNo, CONCAT(COALESCE(HouseNoName, ''), ' ', COALESCE(StreetName, ''), ' ', COALESCE(TownOrCity, ''), ' ', COALESCE(Postcode, '')) AS Display, PropID, AreaID, AWGMember, Householder, HouseNoName, StreetName, TownOrCity, Postcode, ContactTelephone, AlternatePhone, Email, PropertyTenure, PropertyNotes FROM prop_property WHERE IsActive = 1 AND (Postcode = '".$searchpostcode."' OR StreetName = '".$searchaddress."' OR ProjectNo = '".$searchprojno."') ") or die(mysql_error()); $checkrs = mysql_query("SELECT * FROM prop_property WHERE IsActive = 0"); if(!mysql_num_rows($checkrs) > 0) { echo '<td> No record found!</td><td></td>'; } else { while ($results = mysql_fetch_array($searchrs)) { echo ' <td id="displayadd">'.$results['Display'].'</td> <td> <form action="../jobdetails.php" method="post"> <input type="hidden" name="searchhouse" value=" '.$results['HouseNoName'].'" > <input type="hidden" name="searchstreet" value=" '.$results['StreetName'].'" > <input type="hidden" name="searchtown" value=" '.$results['TownOrCity'].'" > <input type="hidden" name="searchpostcode" value=" '.$results['Postcode'].'" > <input type="hidden" name="searchpropid" value=" '.$results['PropID'].'" > <input type="hidden" name="searchprojectno" value=" '.$results['ProjectNo'].'" > <button type="submit" class="btn default btn-xs blue-stripe" id="viewsearch" name="viewsearch">View Address</button> </form> </td>'; } }?> </tr> </tbody> </table> </div> </div> </div> </form> <div class="modal-footer right"> <button type="button" data-dismiss="modal" class="btn default">Cancel</button> </div> <script type="text/javascript"> $(function(){ $('#searchform').on('submit', function(e){ e.preventDefault(); //alert($('#searchpostcode').val()) $.post('includes/jobdetailssearch.php', $('#searchform').serialize(), function(data, status){ $('.table-responsive #displayadd').html(data.Display); //$("#table-responsive td").last().append(data); console.log("done"); }).fail(function () { console.log("fail"); }); }); }); </script> How can I get it to POST the INPUT to the database and return in the table?
  2. Hello I'm looknig for a code that can guide me to generate four chained selects with data from mysql database, that let me add new rows to a table that maintain the same logic of the four chained select with data from mysql when I do click an add row button and so on. Anyone can give me a link or download site that I can use to build that I want? Could be a JavaScript, jquery or php code that let me do what I want in HTML. Best Regards
  3. Hi i want to change the attribute of a div id when the div is clicked.. but its not working for some reason ? $('#prev').attr('id',''); $('#next').attr('id','2'); //Pagination Click $(".controls").click(function(){ $("html, body").animate({ scrollTop: 0 }, 700); $('#next').removeattr('id',''); $('#prev').attr('id',''); $('#next').attr('id','7');
  4. Okay so i have a file that i need some php variables from. This is the code that i am using. please help ! This is the ajax that i am trying to use to get the variable and then set it to a php variable. $.ajax({ url : 'pagination_data.php?page=1', type : 'POST', data : data, dataType : 'json', success : function (result) { var k=result; <?php $next ?>=var k; }, error : function () { alert("error"); } }); Now here i am setting the varialbes in the other file. $next = $page+1; $prev = $page-1; echo json_encode($next); echo json_encode($prev); and this is where i need the variables... <?php echo "<div class='controls' id='$prev'></div><div class='controls' id='$next'>"; ?>
  5. I need help with adding some ajax to my jquery script to pass a php var to a modal. I can open the modal with the bit of jquery below but I am at a lose on how to add any ajax to this jquery script to take the $id from the link to the modal. The jquery I am opening the modal with $(document).ready(function(){ $(".launch-modal").click(function(){ $("#editexpenses").modal({ keyboard: false }); }); }); I am opening the modal with this link to the jquery <a id="<?php $id ?>" title="Edit this item" class="launch-modal" href="#editexpenses">edit</a> The modal <div class="modal fade" id="editexpenses" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title" id="myModalLabel">Modal title</h4> </div> <div class="modal-body"> <?php $id = $_POST['expID']; echo 'id' . $id; var_dump($_POST); ?> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal -->
  6. I have started playing around with jQuery mainly to allow me to create complicated forms without clicking through several php pages collecting all the data. It's is probably not relevant but I will give the full picture of what i am attempting feel free to ignore this paragraph if it is of no use! I have a table of MySQL rows with checkboxes. There will be 3 different options for bulk processing of the checked rows and on clicking one of the options a hidden div will fade in and the options buttons will disappear (to prevent several options divs being opened at the same same). In the div there will be form elements relevant to the bulk processing option chosen. For the first one it is simply one text input. Upon Submit it will validate that the input is not empty and if so, execute the function that posts the data. The data gets posted, the div gets replaced and a success message is displayed, plus the bulk option buttons return ready to choose another option. This new div gets hidden once a bulk option next gets clicked. This all works correctly but there is an issue with clearing the validation. So the problem I actually have is that after successful validation and script execution the data is still in memory so if I run through the process again with an empty field, you see the validation error message again, briefly, but the script still runs. Is there any way to clear everything still in memory at the end of script execution? I have tried a few suggestions I have seen and a few things I have tried as a complete guess-up but no joy.... $('#bulkMatchActions').valid=false; $('#bulkMatchActions').validate=false; $('#bulkMatchActions').valid=null; $('#bulkMatchActions').validate=null; removeData(validator); removeData($.post); removeData('#bulkMatchActions'); I am sure that there must be a way to do this but I am completely stumped. If anyone can offer any suggestions I would be grateful. Also, although this code is something I am just playing around with and will not be used on a production site, if there is anything in the scripts that could be done better, feel free to say. but don't be too harsh!! Thanks in advance Steve The Validation part //Validate Defaults jQuery.validator.setDefaults({ debug: true, success: "valid" }); //Validate Rules $(function(){ var validator = $('#bulkMatchActions').validate({ rules: { ppReason:{ required: true } }, messages: { ppReason: "Please enter a reason" } }); //On Submit, run the posting script $('#postponeSubmit').click(function(){ if($('#bulkMatchActions').valid()){ postponeSubmit(); //After the above script is run, I want everything set to NOT VALID ready to validate an empty field again }else{ return false; } }); //Empty the form validator.resetForm(); }); The actual posting script //Postpone function postponeSubmit(){ $('#postponeSubmit').click(function() { var ppSubmit = 'ppSubmit'; var ppReason = $('#ppReason').val(); var checkBox = $.map($('input:checkbox:checked'), function(e,i) { return +e.value; }); var checkBox2 = $('#checkbox'); $('#postpone').fadeOut('fast'); $('#postpone2').fadeIn('fast'); $('#postpone2 p').text('Loading....'); $.post('inc/processForm.php', { ppReason : ppReason, ppSubmit : ppSubmit, checkBox : checkBox }, function(data){ $('#postpone2 p').html(data); showBulkControls(); }); }); }
  7. Hey guys, Stuck on this for a couple days now. I am using a 3rd party video gallery function that uses jquery. http://codecanyon.net/item/responsive-video-gallery-html5-youtube-vimeo/2918602 The gallery works great when the list is hard coded, but as soon as I use a PHP mysql query to echo out the list the video gallery becomes buggy and hangs (works about 25% of the time). The higher I set the limit on the query the worse it performs (works great if I limit it to only 1). Any ideas what could be the issue? I am completely out of ideas. Is my PHP code bad? This list hard coded list works perfect: <ul id='mix1' data-address="mix1"> <li data-address='youtube_single1' data-type='youtube_single' data-path='http://gdata.youtube.com/feeds/api/videos/SVdc8ec_bGg?v=2&format=5&alt=jsonc' ></li> <li data-address='youtube_single2' data-type='youtube_single' data-path='http://gdata.youtube.com/feeds/api/videos/WwRrKaq0IyY?v=2&format=5&alt=jsonc' ></li> <li data-address='youtube_single3' data-type='youtube_single' data-path='http://gdata.youtube.com/feeds/api/videos/36kmXKP_l7I?v=2&format=5&alt=jsonc' ></li> <li data-address='youtube_single4' data-type='youtube_single' data-path='http://gdata.you<li data-address='youtube_single5' data-type='youtube_single' data-path='http://gdata.youtube.com/feeds/api/videos/WwRrKaq0IyY?v=2&format=5&alt=jsonc' ></li> <li data-address='youtube_single6' data-type='youtube_single' data-path='http://gdata.youtube.com/feeds/api/videos/36kmXKP_l7I?v=2&format=5&alt=jsonc' ></li> <li data-address='youtube_single7' data-type='youtube_single' data-path='http://gdata.youtube.com/feeds/api/videos/36kmXKP_l7I?v=2&format=5&alt=jsonc' ></li> <li data-address='youtube_single8' data-type='youtube_single' data-path='http://gdata.youtube.com/feeds/api/videos/36kmXKP_l7I?v=2&format=5&alt=jsonc' ></li> <li data-address='youtube_single9' data-type='youtube_single' data-path='http://gdata.youtube.com/feeds/api/videos/36kmXKP_l7I?v=2&format=5&alt=jsonc' ></li> <li data-address='youtube_single10' data-type='youtube_single' data-path='http://gdata.youtube.com/feeds/api/videos/36kmXKP_l7I?v=2&format=5&alt=jsonc' ></li> <li data-address='youtube_single11' data-type='youtube_single' data-path='http://gdata.youtube.com/feeds/api/videos/36kmXKP_l7I?v=2&format=5&alt=jsonc' ></li> <li data-address='youtube_single12' data-type='youtube_single' data-path='http://gdata.youtube.com/feeds/api/videos/36kmXKP_l7I?v=2&format=5&alt=jsonc' ></li> </ul> Once I use the PHP query and echo for the list the gallery becomes buggy: <ul id='mix1' data-address="mix1"> <?php $query = mysql_query('SELECT video_number FROM videos WHERE video_item_id="'.$pid.'" ORDER BY RAND() LIMIT 10'); $i = 0; class myCounter implements Countable { public function count() { static $count = 0; return ++$count; } } $counter = new myCounter; while ($row = mysql_fetch_array($query)) { if($i % 10 === 0) { } echo "<li data-address='youtube_single".count($counter)."' data-type='youtube_single' data-path='http://gdata.youtube.com/feeds/api/videos/".$row['video_number']."?v=2&format=5&alt=jsonc' ></li>"; $i++; } ?> </ul>
  8. Hi friends, i am new in php, user fill the text box to get the value and post it to the next page using ajax. this is my requirement. i call the textbox in while loop ,so i used the text box name is ship_quantity[] In jquery i get the value like that $('input[name="ship_quantity[]"]').each(function(){ var sq=$(this).val(); alert(sq); now i get the value of 1,2 as user inputs. my questions is how to extract this values and send to ajax post.
  9. var latestMDPver = $.ui.multiDatesPicker.version; var lastMDPupdate = '2012-03-28'; $(function() { // Version // //$('title').append(' v' + latestMDPver); $('.mdp-version').text('v' + latestMDPver); $('#mdp-title').attr('title', 'last update: ' + lastMDPupdate); // Documentation // $('i:contains(type)').attr('title', '[Optional] accepted values are: "allowed" [default]; "disabled".'); $('i:contains(format)').attr('title', '[Optional] accepted values are: "string" [default]; "object".'); $('#how-to h4').each(function () { var a = $(this).closest('li').attr('id'); $(this).wrap('<'+'a href="#'+a+'"></'+'a>'); }); $('#demos .demo').each(function () { var id = $(this).find('.box').attr('id') + '-demo'; $(this).attr('id', id) .find('h3').wrapInner('<'+'a href="#'+id+'"></'+'a>'); }); // Run Demos $('.demo .code').each(function() { eval($(this).attr('title','NEW: edit this code and test it!').text()); this.contentEditable = true; }).focus(function() { if(!$(this).next().hasClass('test')) $(this) .after('<button class="test">test</button>') .next('.test').click(function() { $(this).closest('.demo').find('.box').removeClass('hasDatepicker').empty(); eval($(this).prev().text()); $(this).remove(); }); JS FIDDLE LINK: http://jsfiddle.net/bJ7zj/#update When i go to the month of april and select dates, the date picker resets to march month.
  10. hello every one.... Can any one plz help me how to detect mobile device brand like samsung, nokia or micromax uisng php or javascript.... Any help will be greatly appreciated.... Thank you.. :)
  11. How can I call another script and pass a id so I can fill another drop down pulling data from mysql. I have added the scripts below I just don't understand how to call them $( document ).ready(function() { $.ajax({ //create an ajax request to load_page.php type: "GET", url: "customer.php", dataType: "html", //expect html to be returned success: function(response){ $(".responsetext").html(response); //alert(response); } }); }); THIS SCRIPT FILLES THE DROPDOWE BELOW USING responsetext <select name="customer"id="customer" class="form-control input-sm responsetext"> </select> SO WHEN I SELECT THIS IT WILL PASS THE ID AND RUN THE SCRIPT BELOW $(function() { // document.ready $("#id").on("change", function() { $.ajax({ url: "contact.php", type: "GET", data: { id: $(this).val() }, success: function(data) { $(".contactresults").html(data); } }); }); }); SO IT WILL FILL THIS SELECT BOX WITH contactresults <select name="contact" class="form-control input-sm contactresults" id="contact"> </select>
  12. Hi I'm havaing a problem with some JQM what is suppose to be happening, when the page is shown a list of data is to be shown. When you click one of the list items the popup needs to dynamically update with the text from the clicked list to display in the pop. i.e. if the item clicked is called Sales then the pop up item should be Edit Sales Here is the code I have $('#listPage').live('pagebeforeshow', function (event) { retrieveDisplayList(db, '', function (data) { tf.ui.hideLoadingMsg(); var template = Handlebars.templates.dataList(data); $("#listContainer").html(template); $('#listContainer').trigger('create'); var menuTarget = event.currentTarget; $('.listItem').click(function() { var txt = $.trim($(this).text()); var txtLabel = txt; var links = new Array(); links.push({ id: 'ID-1', page: '/index.html', name: 'Edit ' + txtLabel }); links.push({ id: 'ID-2', page: '/index.html', name: 'View Data' }); var popup = Handlebars.templates.popup({links: links}); $("#surveyPopup").html(popup); $('#surveyPopup').trigger('create'); $("#popup").popup('open', {positionTo: menuTarget}); //$('#surveyPopup').trigger('update'); }); }); });
  13. Hello everybody, I'm working on a script which has 2 div tages controled by 2 radio buttons and using jquery to hide/show the div tags based on the users selection. Like to have.. if a user selects one of the radio button i like to maintain the selection radio button and the div tag if the page is refreshed. Problem: if the user selects the second div tag and if the page refreshes the radio button and the div tag returns to the initial setup which is going back to the first radio button and div tag. how do i maintain the selection, radio button and the div tage after a refresh? <script type='text/javascript'> $(document).ready(function() { $("#DivB").hide(); $('input[name="myproject"]').change(function() { if($(this).val() == "A") { $("#DivA").show(); $("#DivB").hide(); } else { $("#DivA").hide(); $("#DivB").show(); } }); }); </script> <div style ="border:1px solid black;"> <form action='<?php echo $_SERVER['PHP_SELF']; ?>' method='POST'> <div id="div1"> <input type='radio' name='myproject' value='A' checked="checked" <?php echo (isset($_POST['myproject']) && $_POST['myproject'] == 'A') ? 'checked':''; ?> />Have projectID <input type='radio' name='myproject' value='B' <?php echo (isset($_POST['myproject']) && $_POST['myproject'] == 'B') ? 'checked':''; ?> />Lost projectID<br /> </div> <hr /> <div id='DivA'> projectID:<br /> <input type="text" name="proId"><br /> email: <br /> <input type="text" name="email"><br /><br /> <button name="btn_prj_info">View project status</button> <br /> </div> <div id='DivB'> Email: <br /> <input type="text" name="emailR"><br /><br /> <button name="btn_email">Email information</button> <br /> </div> </form> </div>
  14. Hey Guys ! i'm not sure if i posted my topic in the right side anyway .. i have a countdown.js file everything is OK , but the big problem is the countdown not working at all ,( Days , Hours ,Min , Sec) all of this keeps in zero but the count UP work normal this is the source code : http://jsfiddle.net/NdfPR/2/ in line 29 and 30 until: new Date(2014, 4 - 1, 4, 0, 0, 0), since: null, nothing happen with this code but if i changed to this until: null, since: new Date(2014, 4 - 1, 4, 0, 0, 0), the count up will work and i don't count up ,, this js file is linked to my template so if there's anything to solve this problem ,, i'm here if i forget anything to
  15. I worked with PHP for several years, then have worked for the last 2 with Coldfusion. I do the following in coldfusion and tried the same type of thing in PHP, but PHP does not return proper results. Does anyone know how I can make this work in PHP? Any tips/help VERY much appreciated, I an my daughter have a lot of coding work waiting for this answer! Neither one of us can figure this out. Coldfusion example: //in the javascript/jquery section of the page: function getOrders(customerid){ $.get('scripts/orderrequests.cfc?method=getOrders&custid='+customerid, function(data){ document.getElementById('orderdiv').innerHTML = data; } ); } then further down on the page <a href="javascript:getOrders(#customerid#)">Click here to list all of your orders.</a><br> <div id="orderdiv"></div> --------- then, briefly... in scripts/orderrequests.cfc is the coldfusion function that gets the orders out of the database, and returns an entire html table of the orders <cfunction name="getOrders" ...> <cfargument name="custid" required="yes"/> <cfquery.... gets the order info out of db just like any mysql query basically...> <cfsavecontent variable="tableinfox"> <table> <tr><tr><td>#orderid#</td><td>#orderdate#</td></tr></table> </table> </cfsavecontent> <cfreturn tableinfox/> </cfunction> ------------------- The scenario beautifully loads the order data into the div "<div id="orderdiv"></div>" above. Been using this for two years in coldfusion, and I would LOVE to figure out how to do the same scenario in PHP, so I tried.. function getOrders(customerid){ $.get('includes/gettheorders.php?custid='+customerid, function(data){ document.getElementById('orderdiv').innerHTML = data; } ); } <?php echo '<a href="javascript:getOrders('.$customerid.');">Click here to list all of your orders.</a><br /><div id="orderdiv"></div>'; ?> Then, "includes/gettheorders.php" is just a simple php query that loads the orders into a table...outputs it to it's own page, which then should be returned as that "data" in function(data)... and loaded into the div.. "document.getElementById('orderdiv').innerHTML = data;" When I tried this with various code on "gettheorders.php", the best I can do is that, "gettheorders.php" can return ONE number "3" but not "content" like an HTML table full of content.. What do I need to do to make this kind of scenario work in PHP? I obviously want to return more content than just a number. I am so hungry for this answer, you don't even know.. but then you are programmers who have also banged your head against your desk, so I guess you do!
  16. Hello, so I am a new member here and I would need some help. I could'nt decide if I post my problem to ajax or javascript topic . I have bought dating site software called eMeeting. I tried to add a custom javascript slider to the header. The slider needs jquery library to work, but when I import the library, other scripts from the webpage stop working. So here is a quick demo. This is my sites header. When I click to "SMS Kuulutused" link (marked with red circle) this appears: So the problem is now when I click to the status box on the same page nothing happens. But if I comment the line below (located in sliders js file) <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> Other javascripts from the page will work again and the result for this demo when clicked the red circle would be this: It would be really nice if someone has some time to help me or give me some suggestions. Also the webpage is http://flirt.ee Best Regards, Mairo
  17. Hello, I'd like to know if someone know how I can do this. Example when sites use this function is in a store etc. You choose your product-types, if you for example chose a larger size, the price becomes higher and then it updates in real time. So what I mean is like, the number increases/decreases depending on the users selections, if he wants that or not that included, the number changes so he/she can see the exact price he needs to pay for the product. Like this for standard ---------------- 25$ --------------- but if I for example choose a larger size it automatically updates to ------------- 30$ ------------ I hope u understand what I mean. Thanks in advanced
  18. I had a doubt regarding the facebook-link-previewer (http://lab.leocardz.com/facebook-link-preview-php--jquery/).Can you please tell me where the control goes once we hit the post button? What should i do if i have another variable i want to pass when the post button is hit. I dont see any $_POST or $_GET. Can someone please help me.
  19. I'm trying to learn jquery and ajax and not doing so well I am trying to pass the id from this dropdown when it is selected to the next ajax script and it is not working. Both scripts pull there data from the same table so if there is a way to do this with one script I would be interested. <select name="customer"id="customer" class="form-control input-sm responsetext" > </select> $( document ).ready(function() { $.ajax({ //create an ajax request to load_page.php type: "GET", url: "customer.php", dataType: "html", //expect html to be returned success: function(response){ $(".responsetext").html(response); //alert(response); } }); }); <?php include("connect.php"); $id = $_SESSION['profile']['id']; echo "<option value=''>SELECT A CUSTOMER</option>"; foreach($db->query("SELECT * FROM customers WHERE pid = '$id'") as $row) { echo "<option value=" . $row['id'] . ">" .$row['name'] . "</option>"; } The above script creates the select box and it works. Now I need the $row['id'] To be picked up by the next script to fill in the input field. <input name="contact" class="form-control input-sm contactresults" id="contact"> $(function() { // document.ready $("#id").on("change", function() { $.ajax({ url: "contact.php", type: "GET", data: { id: $(this).val() }, success: function(data) { $(".contactresults").html(data); } }); }); }); <?php include("connect.php"); $id= $row['id']; echo "<option value=''>SELECT A CUSTOMER</option>"; foreach($db->query("SELECT * FROM customers WHERE id = '$id'") as $row) { echo $row{contact"}; }
  20. Is there some way to make it to where a user is only allowed to the site if they have donated to the site ? otherwise they get a page where it askes to donate to the site and then they can access the content in the back ? I would like to do this in PHP
  21. I have this code: checkbox : function(elem) { $(function() { var isChecked = elem.checked, $check = $(this).val(), $address = $('.'+ elem.id); $image = $('.imagenone'); if(isChecked) { $address.stop().fadeIn("slow").css("display","inline-block"); $image.stop().fadeOut("slow").css("display","none"); } else { $address.stop().fadeOut("slow"); } }); } I need check if id of "$address"(class) displayed, not display other div with same id. I have a "query" which lists all the "rows" of the table, each "row" has a sub-category and associated product, which in my case the sub-category is the class and id is the product. but for different sub-categories can have the same product, not wanting to give the same id / product appear in duplicate. the problem is that there are only checkboxes for sub-categories, where the purpose is to create a filter. where all products with this sub-category, choosing more than one sub-category to check the sub-category appear. In different sub-category may contain the same products, just wanting to appear only once, and not repeated, ie not appear divs with the same id (same product) in duplicate. Structure Product List - http://s30.postimg.org/p0j37jl01/coding.jpg ps: sorry my bad english !
  22. I made a chat program where you enter your name and then a message, and it posts it so everyone can see it. Let's say that a user is logged into Facebook, and he goes on to my chat, can I have the chat check the Facebook account that he is logged into for his name, and then auto fill his name in the name input box?
  23. I have a table called tb_app with fields 'id','aic','batchcode','name' example table value: '1','0001','1','james'. As you can see there are three textboxes(name)(aic)(batchode). I want to show the value of aic and batchcode in their correspoding textboxes after typing the specific name in the textbox(name). The problem is when you type james in the textbox(name) it shows '00011' in the (aic)textbox and (batchcode)textbox...i want it to be '0001' in aic and '1' in the batchcode if i type james which is stored value in the table. html code: <form method="post"> <input type="text" name="names" id="query" onblur="getvalues()"/> <input type="text" name="aic" id="aic"/> <input type="text" name="batchcode" id="batchcode" /> </form> script code: <script type="text/javascript"> function getvalues() { var selname = $("input[name=names]:text").val(); $.ajax({ url: "getuserdata.php", data: {"selname":selname}, type: 'post', success: function(output) { $("#aic").val(output); $("#batchcode").val(output); } }); } </script> getuserdata.php page: <?php include('include/connect.php'); $selname = $_POST['selname']; $query = "SELECT * FROM tb_app WHERE tb_app.name RLIKE '$selname'"; $result = mysql_query($query) or die(mysql_error()); while($rows = mysql_fetch_array($result)){ echo $rows['aic']; echo $rows['batchcode']; } ?>
  24. Hi there, My head is stuck at this moment. I've got a textfile with words. Each word starts at a new line. I want to let the user delete a word(line) from this textfile after a button click. I managed to add the "add word to the list" function, but now i want a delete button variant. There are four files. myscript.js, vulwoorden.txt, word_filter.php and delete.word.php. This is the code for myscript.js: //User can add word to wordfilter $("body").on("click", ".hide_word", function(e){ e.preventDefault(); var word = $(this).data("word"); $.ajax({ url: 'includes/set.word.php', type: 'POST', data: 'word=' + word, success: function (){ }, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.status); alert(thrownError); } }); $(this).parent().parent().hide('slow', function(){ $(this).remove(); }); }); //User can delete word from wordfilter $("body").on("click", ".delete_word", function(e){ e.preventDefault(); var word = $(this).data("word"); $.ajax({ url: 'includes/delete.word.php', type: 'POST', data: 'word=' + word, success: function (){ }, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.status); alert(thrownError); } }); $(this).parent().parent().hide('slow', function(){ $(this).remove(); }); }); This is the code for the word_filter page <?php $lines = file('./includes/vulwoorden.txt'); $i=1; echo '<table id="wordlist" class="table">'; foreach ($lines as $line_num) { echo '<tr>' . "<td>" . $line_num . '</td><td>'; echo '<a data-word="' . $line_num . '" class="btn-danger btn-sm delete_word">Verwijder woord</a></td></tr>'; $i++; echo '</table>'; ?> And this is the code for delete.word.php (this code is just a copy from the set.word.php, so this is code to add a word to the textfile. <?php $fn = "vulwoorden.txt"; $file = fopen($fn, "a+"); if(isset($_POST['word']) && trim($_POST['word']) != "" && !is_null($_POST['word'])) { $word = $_POST['word'] . "\r\n"; fwrite($file, $word); } ?> I know how to do it with a form, but i want to do it combined with Ajax, so the users won't have to refresh the page. Thanks in advance!!
  25. This is a general question, thus no script. I'm looking for hints as to what could cause the following: Is there any reason that javascript or jQuery include scripts could prevent radio button values from being sent to the server while all other values from selects and texts are correctly sent? When not using the javascript or jQuery includes the radio values are sent.
×
×
  • 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.