Jump to content

Search the Community

Showing results for tags 'javascrpt'.

  • 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

Found 6 results

  1. Could someone give me a quick clue as to why the following, very simple, JS isn't working properly, please? <script> function toggleResponseArea() { if (document.getElementById("commentResponse").style.display = 'none') { document.getElementById("commentResponse").style.display = 'block'; } else if (document.getElementById("commentResponse").style.display = 'block') { document.getElementById("commentResponse").style.display = 'none'; } return false; } </script> The text area is initially set to display: none; in the stylesheet. I've used an onclick attribute for the 'reply' element in the HTML. And to be clear, when the page is loaded (display: none;) and the reply 'button' is clicked it does change the textarea to display: block; that's not the problem. The issue is when it's clicked again it doesn't change it back from display: block; to display: none; Thanks for the help.
  2. I’m currently trying to building a websocket widget, using node package manager(NPM),WAMPserver and electronjs. the package was well installed because when i start it it works. It log into the console But i dont know how i can handle it with html on wamp server . it seems electronjs is not working for wamp and websocket.
  3. Hi everyone. I'm very new into self learning programming. Presently I'm trying to develop a simple basic Robot that would only Place a Market Order every seconds and it will cancel the Order every followed seconds. Using the following library: https://docs.b2bx.exchange/en/_docs/api-reference.html#private-api It would place Trade Order at a ( Price = ex.com api * Binance api Aggregate Trades Price) I have already wrote the api to call for xe.com exchange rate with php <?php $auth = base64_encode("username:password"); $context = stream_context_create([ "http" => [ "header" => "Authorization: Basic $auth" ] ]); $homepage = file_get_contents("https://xecdapi.xe.com/v1/convert_from?to=NGN&amount=1.195", false, $context ); $json = json_decode($homepage, TRUE); foreach ($json as $k=>$to){ echo $k; // etc }; ?> And also for the Binance Aggregate Price in JavaScript <script> var burl = "https://api3.binance.com"; var query = '/api/v3/aggTrades'; query += '?symbol=BTCUSDT'; var url = burl + query; var ourRequest = new XMLHttpRequest(); ourRequest.open('GET',url,true); ourRequest.onload = function(){ console.log(ourRequest.responseText); } ourRequest.send(); </script> My problem is how to handle these two api responds and also the functions to use them to place a trade and cancel it. Please help me out. Thanks in advance on any help.
  4. Hi guys, I really hope this will make sense. I am creating a dynamic field on a button click for Pickup Location. That works fine and submitting the form to the database works fine. However, instead of one entry, each time I submit the form with multiple Pickup Locations, it creates multiple separate database entries. Here is the PHP for submitting: if(isset($_POST['new']) && $_POST['new']==1){ $pickups = ''; foreach($_POST['pickups'] as $cnt => $pickups) $pickups .= ',' .$pickups; $locations = count($_POST["pickups"]); if ($locations > 0) { for ($i=0; $i < $locations; $i++) { if (trim($_POST['pickups'] != '')) { $name = mysqli_real_escape_string($con, $_POST['name']); $price = mysqli_real_escape_string($con, $_POST['price']); //$origin = $_POST['origin']; $pickups = $_POST["pickups"][$i]; $destination = mysqli_real_escape_string($con, $_POST['destination']); $dep_date = mysqli_real_escape_string($con, $_POST['dep_date']); $ret_date = mysqli_real_escape_string($con, $_POST['ret_date']); $fleet_number = mysqli_real_escape_string($con, $_POST['fleet_number']); $driver = mysqli_real_escape_string($con, $_POST['driver']); $itinerary = mysqli_real_escape_string($con, $_POST['itinerary']); $submittedby = mysqli_real_escape_string($con, $_SESSION["username"]); $trn_date = mysqli_real_escape_string($con, date("Y-m-d H:i:s")); $query="insert into tours (`name`, `price`, `pickups`, `destination`, `dep_date`, `ret_date`, `fleet_number`, `driver`, `itinerary`, `submittedby`, `trn_date`)values ('$name', '$price', '$pickups', '$destination', '$dep_date', '$ret_date', '$fleet_number', '$driver', '$itinerary', '$submittedby', '$trn_date')"; mysqli_query($con,$query) or die(mysqli_error($con)); if(mysqli_affected_rows($con)== 1 ){ $message = '<i class="fa fa-check"></i> - Record Inserted Successfully'; } } } } } Here is the HTML form: <form role="form" method="post" name="add_tour" id="add_tour" action""> <input type="hidden" name="new" value="1" /> <div class="modal-body"> <div class="row form-group"> <div class="col-6"> <div class="form-group"><label for="name" class=" form-control-label">Name</label><input type="text" id="name" name="name" placeholder="Tour Name" class="form-control"> </div> </div> <div class="col-6"> <div class="form-group"><label for="price" class=" form-control-label">Price</label><input type="text" id="price" name="price" placeholder="0.00" class="form-control"> </div> </div> </div> <div class="row form-group"> <div class="col-6"> <div class="form-group origin" id="pickupsfield"><label for="pickups" class=" form-control-label">Pickup Location</label><input type="text" id="pickups" name="pickups[]" placeholder="Start Typing..." class="form-control"></div> <button type="button" class="btn btn-success add-field" id="add" name="add">Add New Location &nbsp; <span style="font-size:16px; font-weight:bold;">+ </span> </button> </div> <div class="col-6"> <div class="form-group"><label for="destination" class=" form-control-label">Destination</label><input type="text" id="destination" name="destination" placeholder="Start Typing..." class="form-control"></div> </div> </div> <div class="row form-group"> <div class="col-6"> <div class="form-group"><label for="dep_date" class=" form-control-label">Departure Date</label><input type="date" id="dep_date" name="dep_date" placeholder="" class="form-control"></div> </div> <div class="col-6"> <div class="form-group"><label for="ret_date" class=" form-control-label">Return Date</label><input type="date" id="ret_date" name="ret_date" placeholder="" class="form-control"></div> </div> </div> <div class="row form-group"> <div class="col-6"> <div class="form-group"><label for="fleet_number" class=" form-control-label">Fleet Number</label> <select class="form-control" id="fleet_number" name="fleet_number"> <option value="Select">== Select Fleet Number ==</option> <?php $sql = "SELECT fleet_number FROM fleet"; $result = $con->query($sql); while(list($fleet_number) = mysqli_fetch_row($result)){ $option = '<option value="'.$fleet_number.'">'.$fleet_number.'</option>'; echo ($option); } ?> </select> </div> </div> <div class="col-6"> <?php ?> <div class="form-group"><label for="driver" class=" form-control-label">Driver</label> <select class="form-control" id="driver" name="driver"> <option value="Select">== Select Driver ==</option> <?php $sql = "SELECT name FROM drivers"; $result = $con->query($sql); while(list($driver) = mysqli_fetch_row($result)){ $option = '<option value="'.$driver.'">'.$driver.'</option>'; echo ($option); } ?> </select> </div> </div> </div> <div class="form-group"><label for="itinerary" class=" form-control-label">Itinerary</label> <textarea class="form-control" id="itinerary" name="itinerary"></textarea> </div> <div class="modal-footer"> <button type="reset" class="btn btn-warning">Clear Form</button> <button type="submit" name="submit" id="submit" class="btn btn-primary">Confirm</button> </div> </form> And the Javascript for adding the new fields: <script> $(document).ready(function(){ var i = 1; $("#add").click(function(){ i++; $('#pickupsfield').append('<div id="row'+i+'"><input type="text" name="pickups[]" placeholder="Enter pickup" class="form-control"/></div><div><button type="button" name="remove" id="'+i+'" class="btn btn-danger btn_remove">X</button></div>'); }); $(document).on('click', '.btn_remove', function(){ var button_id = $(this).attr("id"); $('#row'+button_id+'').remove(); }); $("#submit").on('click',function(){ var formdata = $("#add_tour").serialize(); $.ajax({ url :"", type :"POST", data :formdata, cache :false, success:function(result){ alert(result); $("#add_tour")[0].reset(); } }); }); }); </script> Anyone have any idea where I am going wrong? Before you say it, Yes, I know, Use Prepared statements 😷
  5. contact.php ... html form ... $('#submit').click(function(){ $.post("mail.php", $("#contact").serialize(), function(response) { $('#success').html(response); }); return false; }); mail.php is a separate file (for sending mail), and everything works in this arrangement. But I need to load contact.php into index.php $('#divR').load('chapters/contact.php'); so corresponding js line becomes $.post("chapters/mail.php", $("#contact").serialize(), function(response) {... Submitting the form in this case response from mail.php is received, but POST array is empty, i.e. form doesn't send any data to mail.php !?
  6. How can I remove MouseWheel in mozilla firefox only ?
×
×
  • 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.