logo
down
shadow

change custom data- value after ajax post success


change custom data- value after ajax post success

Content Index :

change custom data- value after ajax post success
Tag : php , By : can
Date : November 24 2020, 01:01 AM

wish of those help Okie so I thought this was a neat looking bit of css and thought I would try to plug it into my website and replace my existing "recommend/recommended" bit of ajax/query that is working just fine, but is not as well, pretty. , Change the way you are updating your attribute value as
document.getElementById("love").setAttribute("data-count","<?=$TotalRecommendations+1;?>"); 

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

ajax success but not sending post data


Tag : php , By : Hugo
Date : March 29 2020, 07:55 AM
may help you . Your datastring should contain data encoded as application/x-www-form-urlencoded
e.g.: var datastring="foo=123";

Getting ajax post data on success


Tag : php , By : SilverRuby
Date : March 29 2020, 07:55 AM
I hope this helps . Well, if you're posting, you should use the jquery post function here
$.post(
    url,
    {lan_setting:"en"},
    function( data, status, jqXhr ){
        alert(data.lan_setting);
    },
    "json"
);
<?php
    // do stuff

    $response = new stdClass;
    $response->lan_setting = $_POST["lan_setting"];
    print json_encode($response);
?>

Ajax, post data but not callback success


Tag : javascript , By : dummyadresse
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , Yes I know there is so many question like mine, I looked all questions and answers but The solutions is given didn't help me.
/* Change few of your lines: */

<button id="loginButton" type="submit" class="btn btn-success pull-right" onclick="login(event)">GiriƟ</button>

AND 

function login (e) 
    {
        e.preventDefault();
        var Name = $("#userName").val();
        var Pssword = $("#userPassword").val();
        ...
        and further remains same.

ajax on success post form and change page


Tag : javascript , By : Habikki
Date : March 29 2020, 07:55 AM
like below fixes the issue I have to admit, i'm a bit unclear still on the first part of what is happening during your submission, however, you could add yourself to the onsubmit function to first send the data to your ajax-target, and after you have completed the request (succesfully) redirect the user to the second page.
// be sure to always return false, otherwise the default method would be used
function postForm(formElement) {
  if (typeof formElement === 'undefined' || !formElement) {
    // invalid call (expects at least the form element)
    return false;
  }
  // you could do some validation here, if you want, if it's unsuccesfull, show a message and return false
  // ...
  // check if the request hasn't been sent yet, if so, return false won't be resubmitted
  if (postForm.active) {
    return false;
  }
  postForm.active = true;

  // add a default option for the ajax call (in case no js is available, this option wouldn't be there
  // so you could redirect the page from aspx page)
  var data = {
      ajax: 1
    },
    hiddenElements = $('[type=hidden]'),
    i, 
      len, 
      dataKey, 
      dataValue, 
      dataItem,
      targetUrl = formElement.getAttribute('data-redirect');
  
  // get the hidden values to send that were added to the form
  for (i = 0, len = hiddenElements.length; i < len; i++) {
    dataItem = hiddenElements[i];
    dataKey = dataItem.name;
    dataValue = dataItem.value;

    if (typeof data[dataKey] !== 'undefined') {
      data[dataKey] = ',' + dataValue;
    } else {
      data[dataKey] = dataValue;
    }
  }

  // send the ajax request
  $.ajax({
    url: formElement.action,
    type: formElement.method || 'post',
    data: data,
    complete: function(response, state) {
      // free the form again (can be resubmitted at this time)
      postForm.active = false;
      if (state !== 'error') {
        // success, navigate to defined data-redirect
        window.location.assign(targetUrl);
      } else {
        // failed throw error, show message to user
        alert('Error occured during the request: ' + state);
      }
    },

  });
  // return false so that the form doesn't submit on its own
  return false;
}

// attach to all css class with name .submitter (allowing you to attach the mock submit request site wide)
$(function() {
  $('.submitter').on('click', function(e) {
    e.preventDefault();
    $('#mok').submit();
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form action="[send-ajax-data-target-url]" method="post" id="mok" onsubmit="return postForm(this);" data-redirect="Confirmation.aspx">
  <input id="mail" type="hidden" value="data" name="m" />
  <button type="submit">Mock request</button>
</form>

<a href="#" class="submitter">Mock request</a>

Ajax POST Success But No Data Are Send


Tag : jquery , By : Nandor Devai
Date : March 29 2020, 07:55 AM
will help you I have problem to upload multi file using ajax, in this case im using codeingiter, when I call $_POST array return null on upload function, this is my my form I'm using this snippets , Try with $_FILES
public function test_upload()
{

    echo "<pre>";
    print_r ($_FILES);
    echo "</pre>";

}
<input type="file" name="files[]" multiple />
Related Posts Related QUESTIONS :
  • Using php to create a password system with chinese characters
  • PHP is not called properly in IE using set interval function in Javascript
  • How to read pdf, ppt, xl, doc files content into a string in php/python
  • php script for currency conversion
  • In PHP... best way to turn string representation of a folder structure into nested array
  • PayPal for Indian Rupees (INR) any solution
  • PHP Deployment to Live Server
  • Ideal Multi-Developer Lamp Stack?
  • How can I save an image from a file input field using PHP & MySQL?
  • Warning: array_multisort() [function.array-multisort]: Argument #1 is expected to be an array or a sort flag in
  • Connecting to external MySQL DB from a web server not running MySQL
  • Is it possible to add custom fields to a Drupal taxonomy term?
  • PHP 6.0 - Roadmap?
  • jQuery wait for ajax call to be over before continuing
  • checkUnique function?
  • How to define an n-m relation in doctrine?
  • Sort the unsorted text file and rewrite to same text file in sorted order
  • Version control a content management system?
  • How can i run Single PHP File using apache-tomcat-6.0.18?
  • Array of objects is empty when I come to retrieve one from the array
  • PHP Library: Calculate a bounding box for a given lat/lng location
  • Good Wordpress Theme/plugin for showing off code examples and scripts
  • Replace all spaces and special symbols with dash in URL using PHP language
  • globally get any field value in user table of logged in user
  • Can you get a job if you know XHTML, CSS and Basic PHP?
  • HTML Upload Form will only upload files found in the directory of the PHP file
  • Determine if a PHP array uses keys or indices
  • Are frameworks really necessary for beginners/intermediates?
  • PHP File Downloading Questions
  • Who owns a php exec tar extracted file?
  • Best way to get timezone of user based on area code
  • Mysql BETWEEN clause being ignored. No syntax error
  • Zend Framework: Getting request object in bootstrap
  • PHP + GD: imagetruecolortopalette not keeping transparency
  • Good Guide For Web App Security?
  • Creating a new wordpress post from twitter tweets
  • Query to show images with recent posts in Wordpress sidebar/widget
  • select & print multiple value from dropdown list
  • Storing a digital signature for bookings on a web based system
  • How to generate all permutations of a string in PHP?
  • How do I get the PostgreSQL PHP extension working on Windows?
  • Parsing WordPress XML, slash:comments syntax?
  • Hide order status in the status dropdown on WooCommerce admin orders page
  • PHP Converting Hex string to Byte Array - converting VB.Net to PHP
  • Mutiple forms using same php mailer script
  • PHP replace string with value from array
  • Laravel group by issues with an inline select statement
  • Remove featured image from the WooCommerce gallery if gallery exist
  • Detect when a user changes any of their billing details (user meta)
  • Category Wise post page pagination is not working in codeigniter ..?
  • Custom checkbox show or hide custom notice in Woocommerce checkout
  • What is the maximum number of recipients for email sending in laravel?
  • How to get current time in Datetime format PHP?
  • Show or Hide content user role wise
  • How can I write to files through an agi php?
  • Cookie wont set, no result
  • Download and store remote password protected file with PHP
  • Laravel how to get users by roles dynamically from api endpoint
  • Can't find my Mailable class from Route::get
  • Laravel eloquent: How to filter with where() and whereHas()
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com