Runtime environment of a php function called through ajax
Hi, I call a php function with a command like : var result = $.post('/php/fonctions.php', { fonction : 'citation', data : lang}, function( data) { txt_citation.innerHTML = data.citation+" <strong>"+data.nom+"</strong>"; }, "json"); In the file fonctions.php I have a line " $_POST["fonction"]($_POST["data"]); " to call my function. I tried with " call_user_func_array($_POST["fonction"], $_POST["data"]); " but it never work I I don't know why. If you can explain me why it's good but
Ajax popluate form with data of json response
hi , sorry for english : My response of consol.log is: {id: "4", name: "Marco Rossi", email: "marco_rossi@info.it", phone: "333333333"} how can i populatemy form : <form method="post" action="#"> <input name="name" type="text" id="name" value="" /> <input name="email" type="text" id="email" value="" /> <input name="phone" type="text" id="phone" value="" /> <button class='add' type"submit"> </form> This is my ajax: $('.add').click(function() {
Continue iteration until button Stop is clicked
I have a div showing letters one at a time. var abcdef = ["A", "B", "C", "D", "E", "F"]; var time = 500; jQuery.each(abc, function(i, item) { setTimeout( function(){ $("#container").empty().append(item); }, time) time += 10000; }); <div id="container"></div> <input type="button" value="Start" /> <input type="button" value="Stop" /> So all the letters is shown one by one but only but only one round. I need the each loop to continue until I press
Remove previous closest class
From within a table cell represented by "$(this)" I need to remove the closes previous class of the name "highlight", within the same column. How can I do this?
How to target elements that are same class as sibling element?
When selectbox1 (.select-selected) is clicked on, dropdown1 (.select-open) displays. Correspondingly when selectbox2 is clicked on while dropdown1 is still open, dropdown1 will close, while dropdown2 will open. How do I do this? My current code does not work. My dropdown class .select-open is a sibling element to the selectbox element (.select-selected). <div class="select-selected"></div> <div class="select-items select-open"></div> $(".select-selected").click(function() { if ($(this).siblings(".select-items:not(this)").hasClass("select-open"))
How to pass URL string into JSFiddle for jQuery testing
What's the best way to pass a URL string into JSFiddle so I can test a new jQuery script?
Not able to fetch value for edit Data Modal Form, from db through json data response
i need to fetch specific data from database and to be show in modal form ( Update / Edit Form ) , for i.g in form elemen i have this : <div class="form-group"> <label for="nama" class="col-sm-2 control-label">Nama</label> <div class="col-sm-10"> <input type="text" class="form-control" id="name" name="name" > </div> </div>then function event onclick button submit . function editEmploy(id = null) { if (id) { //fetch data $.ajax({ url:'pegawai/editpeg.php',
missing leading zero id from db using ajax
inside mysql db which is table employe in coloumn id_employee, some data have a leading zero, etc : id_employee : 0378192919 empy_name : Jack i need to get id_employee for delete employe in my aplication, then i using ajax method like this : if(id) { alert(id); $("#deleteBtn").unbind('click').bind('click',function(){ $.ajax({ url: 'pegawai/delpeg.php', type:'post', data: {emp_id : id}, datatype: 'json', success:function(response)
Dynamic divs not working in IE11
We're displaying data based on parameters in the URL string and it's working fine in Chrome and Firefox, but not in IE11. Here's what we have. CSS .welcomeNew{ display:none; } .welcomeBack{ display:none; } iQuery $(document).ready(function() { var visitor = new URL(location); var newvisitor = visitor.searchParams.get("v") if (newvisitor == '0') { $('.welcomeNew').show(); $('.welcomeBack').hide(); } else { $('.welcomeBack').show(); $('.welcomeNew').hide();
show only 10 rows of a <table> markup and then change the list with arrows
Hi everyone, I have to tell you that i'm not english before you judge my english level xD. I wanted to know how can i show only 10 rows of the <table> markup then add right and left arrows wich make the list go to the next or previous list. I just need an exemple to understand how it works, i can't send you my code, because if i send you 1200 lines I don't think you'll have the time to read it.
Ajax Call to PHP - TypeError - obj is undefined error
Trying to read ASCI color codes in order to see them on the screen. I am reading a file that is a json file to start with. My code is below. The response is in the attachment Created by Web Developer tools. Here is my php code. <?php // Read JSON file $json = file_get_contents('./ASCIColors.json'); echo $json; ?>Here is my html code. <!DOCTYPE html> <!-- Comments about the program --> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title> Pizzi Contacts
How to clear data in dynamic bootstrap modal carousel (ajax)
Hi. I’ve been create a dynamic code for modal carousel in ajax and bootstrap 4. I have not been able to clear the bootstrap carousel content after each event in ajax calls. I have tried to use some jquery functions like ('.imagen').remove, (’.data-slide-to’).html("") or $(“body”).html(content) in ajax to refresh the page and prevent increases of data every time I open modal carousel but the html content is not removed. Someone knows how to get it. Thanks in advence. index.php <!DOCTYPE html> <html
Datepicker + Moment.js months calculation (and reverse)
I have the following two input fields. In the first one there's a dropdown with the months values and on the other one i have the datepicker input box. Using the boostrap-datepicker and moment libraries, I want to achieve the following: 1) On dropdown selection the datepicker value should change based on the month value [DONE!]. 2) On date change it should check if there's the specified value of months interval in the dropdown on the left and then add the "selected" attribute on the option. Here's
jQuery Val() Function Cannot Change Dropdownlist Selected Value
I have a VB.net web form that consists of a dropdownlist called ddlAuthor, a textbox called txtYear, a search button, and an asp.net gridview. After user selects the author's name in the ddlAuthor dropdownlist box, type in the year in the txtYear textbox, and click the search button, a gridview called AuthorGridView will show up. The gridview consists of Author , Book Title, Year of Publication, and Coauthors columns. The left most column in each row of the gridview contains the Edit link followed
A scrollable month column in a table
What I have been asked to look at is within a table, we have 1 column that is a month column and beneath it are rows of data as figures. As there 12 months, I cant fit them all in one column, so what I want is for it to be January on load, and either side there arrows, if the user clicks the right arrow it goes to February and the whole column moves to the left to display the data for February. Then if they click the right arrow again March appears, and all the data for march in each row in that
How to change specific characters at the end of ALL hyperlinks w/in webpage with jQuery
Hey all, I have a list of items with titles that are hyperlinks to the actual content. The code below removes the .aspx part from the title, but for some reason the code also changes all titles for each item to be the same. Each item should have a unique title with the .aspx removed. Any help is appreciated! $(document).ready(function () { var val = $(".dfwp-item .link-item a").html(); $(".dfwp-item .link-item a").html(val.substring(0, val.length -5)); });
Query undefined when trying to match dates
When trying to check if dates match in two divs, e.g. <div class="start_date">Wednesday 01 January</div> <div class="end_date">Wednesday 01 January</div> This is what I've written so far, but keep getting "undefined" var a = $('.start_date'), b = $('.end_date'); if( a.text() == b.text() ) { $('.end_date').addClass('hide'); } Any ideas what I'm missing...?
run script when loading a jquery page with a link
Hello and thank you in advance for your help.
I am creating a small mobile application for viewing videos. I want that on a click, they can perform an action. So instead of using an iframe from youtube I use the youtube API. As presented in the code page attached.
I have two pages of sub-menus before accessing the page that contains the links to the videos (so the page is probably called in AJAX) The problem is that when I run the page the video is not immediately created by the youtube API. she
Pull specific areas of data from XML
This is the XML file and I can pull through all of the data, however I want to be more specific, for example there are multiple addresses and I want address1 from id=4 and then email from id=6 <Members> <Member Member_Id="4133" Dods_Id="62823" Pims_Id="5593" Clerks_Id="1220"> <DisplayAs>Andrew Bridgen</DisplayAs> <ListAs>Bridgen, Andrew</ListAs> <FullTitle>Andrew Bridgen MP</FullTitle> <LayingMinisterName/> <DateOfBirth>1964-10-28T00:00:00</DateOfBirth> <DateOfDeath xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
Link manipulation (DOM-based)
Hi all, we use jquery-3.3.1.js in our application. Burp scan found a Link manipulation (DOM-based) vulnerability in JQuery sources: // Anchor tag for parsing the document origin originAnchor = document.createElement( "a" ); originAnchor.href = location.href; Data is read from location.href and passed to the 'href' property of a DOM element via the following statement: originAnchor.href = location.href; and one more place: // Set the base href for the created document
Using to jQuery to access JSON nested array starting with dates
I'm attempting to build a ajax call from some json data jQuery.ajax({ type: "GET", url: "websiteurl.com", success: function(data) { jQuery.each(data, function(i, val) { $("#label").append(document.createTextNode(val.label)); $("#url").append(document.createTextNode(val.url)); }); } }); Here is the jSon (url I've been given) { "2019-01-29T00:00:00+00:00": [ { "type": "refuse", "label": "Refuse",
Modify or add jQuery to show unlimited entries from another lookup list from SharePoint Online
Hello all, I am using from a online post which you have cascading parent/ child/ grandchild list with the help of two jQuery's. Main js.file -------------------------------------------------------------------- $.fn.HillbillyCascade= function (optionsArray) { var Cascades = new Array(); var NewForm = getParameterByName("ID") == null; $.fn.HillbillyCascade.Cascade = function(parent,cascadeIndex) { if (cascadeIndex!= null && cascadeIndex+1 > Cascades.length) { return; } else if(cascadeIndex== null)
How to detect scroll from inner page and apply if statement logic if page is not scrolled?
Hello, I am a bit struggling on this one. I have build an app with Jquery and would like to detect the scrolling on the mobile so I can hide or show my navbar. My first problem is this code example from the jquery website: $( "#target" ).scroll(function() { $( "#log" ).append( "<div>Handler for .scroll() called.</div>" ); }); The problem in this example, it does not show how to apply an "if" statement if the page is scrolled or NOT scrolled. ie: If(pageIsScrolled){ app.navbar.hide('.navbar'); }else{
animated background color using jquery
Bonjour ! I was wondering if it was possible to create an animated background for the home page of my website using those two png images ? Regarding to this example : belius.de ? By inspecting this site, I understand that using jquery for animation is required. Unfortunetely, I don't know how to use jquery, so I was wondering ,if there is a way to show me the structure of the code to create this movement of gradient or, if there is a simpler way of creating this animated background with images !
Having Issue on Snapping Divs to the Top of Page On Scroll
Demo I am trying to snap each div .item to the top of page on scroll when the top of the div reaches in an specific portion of page. right now this is working on div one but stuck there $(document).ready(function() { var windowHeight = $(window).height(), gridTop = windowHeight * .3, gridBottom = windowHeight * .6; $(window).on('scroll', function() { $('.item').each(function() { var thisTop = $(this).offset().top - $(window).scrollTop(); if ((thisTop >= gridTop) && (thisTop <= gridBottom)) { console.log($(this).data('page'));
scrollTop is not working in iOS mobile
scrollTop is not working in iOS mobile(safari), I have used "var scrollOwnTop = $('body').scrollTop();", getting 75 and 0 if "var scrollOwnTop = $(html).scrollTop();". How will I get the scrollTop value?
Forced to edit link instead of going to link in editable table cell
I have the following code which allows me to edit a cell, but the problem is that when I want to click on the link, it forces me to edit instead. I want to be able to edit only when I click on the pen icon, but I can't seem to figure out how to do it. HTML <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"> <table border="1" style="width:100px" style="height:99px" style="margin:0 auto"> <tbody> <tr> <td ><div class="row_data" edit_type="click"
Delay variable-assigned functions from running till other function done
I have a number of stacks on a page w/ their respective functions. I need to run my stack before the others, or put another way, pause the others till my stack is finished. If this is an example of a variable assigned to a function for another stack that I want to pause. stacks.com_company_product1 = (function() { ... other stack function }); I tried using $.holdReady() to stop all other functions and then release it, but didn't really work. Is there a way to pause those stacks, using their variable,
Expander content div does not scroll to the top of the page when clicked
I have a simple 'tab' effect jQuery slideToggle, where the user clicks a heading .expander-headingand the next() div .expander-content, expands. I am sadly having some trouble offsetting/scrolling to the top of this .expander-content div on click, however. $(".expander-heading").click(function () { $header = $(this); //getting the next element $content = $header.next(); //open up or close $content.slideToggle(325); $(".site-container").animate({ scrollTop: $content.offset().top }, "fast"); }); With
If input pattern matches, copy to another field
All employees of our company have EIDs that are also associated with our work email addresses. For example, our employee ID might be abc123, so our email address is abc123@acme.com. For one of our online forms asking for EID and email, it would be helpful if, when the input matches the pattern of the EID, to populate the EID field as well. For example, let's say an employee enters the following for email: john.doe@gmail.com Nothing would populate into the EID field. Now, let's say the employee
Code to highlight selected area with CSS
Hello and happy 2019 What I want to achieve is to make "select to inspect" type of functionality, just like the browsers have. It should only have the functionality of creating a temporary element that will be overlayed over the element that my mouse is hovering on. I have created a screencast to show you what it should be like, and what I currently have. Link to video on google drive This is my code written with jQuery It creates a DIV on the page and then, on mousemove event, I set its values
Not working in IE11 although doing in Edge
The following code in Edge work successfully to give "done" message but it in IE11 to give "fail". Hey guys, please show me the way to work it in IE11. <!DOCTYPE html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> </head> <body> <script> $(document).ready(function(){ $("button").click(function(){ $.ajaxSetup({ cache: false}); $.get("load_test.txt", function(data, status){
jquery - moving from 1.10.2 to 3.3.1
i had a page that used jquery min v1.10.2. as the page could sometimes that a little while to fully load (pulling records from a database), i set a simple loader screen that sat on top until the page had loaded then disappeared to show the results below - worked very well. $(window).load(function() { // Animate loader off screen $(".se-pre-con").fadeOut("slow");; }); with this inside the content div <div class="se-pre-con"></div> i've moved the page over to using jquery min 3.3.1 and now the loader
What is a stable (updated and maintained version) photo viewer I can use for an eCommerce website?
Hi all :) I was looking at a variety of different photo viewers like elevateZoom, greasy fork, jQuery Remooz among many others. I couldn't find any with my specific requirements. I'm looking for a splice between these two: https://www.rubylane.com/item/260004-2751/Antique-Metal-Dresser-Box78-Casket-Cupid http://igorlino.github.io/elevatezoom-plus/examples.htm (scroll right down to "Mousewheel zoom" and "Image Constrain" for the thumbnails and mousewheel zoom) The interface is a lot prettier, more
How to query a JSON API and display in html
Beforehand I have zero knowledge of JS or JSQuery only HTML and CSS. I am trying to query this API: https://api.mcsrvstat.us/1/mc.cavernhcf.us and then display it as HTML for a server I am making the thing is I don't know how to do it any help would be great. -Tom
Target image with substring in source
I am trying to target an image that has a specific substring, Ex: {{name-1-field}} in it's src. I'll be updating the src. So if I have this: <img src="../resources/{{name-1-field}}"> I tried a general search function to target the wrapping element: $('*:contains("{{name-1-field}}"):last'); But I guess that only works for text nodes? I'm not sure what would be the best way. Also, is there a quick way to check the type of the wrapping element? Ie. to make sure it's an image.
Using jQuery Validation Plugin to validate then hide email field without submitting form yet
For a two-part form, where the first div shows just the email address and the second div, initially hidden, shows the rest of the fields, is it wise to use the jQuery Validation Plugin validator.element() https://jqueryvalidation.org/Validator.element/ to validate for the email address before hiding that and showing the remaining form fields? For example, can this be done without a form submitHandler following? $("#emailDisplay").validate({ rules: { emailAddress: {
How to remove rows from a table where this table is nested.
I have a Primefaces component rendering HTML. I do not have anyway of controlling (requesting) the primefaces object not to render unwanted elements. So now I am trying to remove unwanted items rendered from the HTML file using jQuery. Many of these components rendered do not have IDs. For example, the following is a partial code I am getting rendered. <html> ...... <div class="ui-widget ui-organigram rightLineStyle lineStyle" id="form:organigram"><div class="target" id="form:organigram_target">
Using jQuery to play a video
I am a Photoshop and After Effects developer and I am completely new to JS and jQuery. I am trying to build a websites for a close friend that highlights a book she has written. I have several 2 second videos of a simulated page turn that I am trying to play when a new page is called and all the content is loaded. I have tried using load() and ready() and have failed completely . I did succeed in getting the video to play using a button and the onClick event. need help desperately
JQuery Script not working in IE or FireFox
I am using the following code to append meta content to product pages when a customer clicks to login. It works great in Safari and Chrome but not in IE, Edge, or Firefox. If I add the meta content to the page directly then it works but redirects the customer before they click the log in button. Here is a link to a page where it is running: https://arkaiosfresh.com/products/pineapple-concentrate . Any corrections would be greatly appreciated. As a point of reference; I have nothing more then very
Next Page