Manipulation of an array sent by ajax to a php file, within a function of another file

Manipulation of an array sent by ajax to a php file, within a function of another file

Content Index :

Manipulation of an array sent by ajax to a php file, within a function of another file
Tag : javascript , By : Simon Hogg
Date : November 28 2020, 04:01 AM

it fixes the issue As I mentioned in my comment, your PHP output only gets generated when the script first runs, before the page renders, so you can't get future submitted data there. So if you're not submitting the data to the same page you're rendering the form on, you need to render the result to the page from the JS, not from the PHP.
So replace the PHP snippet on your HTML page with a div, like so:
, and then write the result to that from the success callback in your Javascript's AJAX call:
success: function(data) {
    document.getElementById('ajax_output').innerHTML = data;

No Comments Right Now !

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

Share : facebook icon twitter icon

Using AJAX to send Javascript string to PHP file, then return array from file

Tag : php , By : user183825
Date : March 29 2020, 07:55 AM
it fixes the issue If your not that knowledgeable in the subject don't attempt to do this via ajax. Simply reload the page with a url var that tells the page what to load ie. table.php?id=users
Once this all working properly without ajax you can add that feature in if it is necessary.

Php array with ajax pass/send to other php file and in the other php file use as array with foreach

Tag : php , By : Vrki
Date : March 29 2020, 07:55 AM
will help you parse_str() actually does what you need.
parse_str($_POST['Values'], $output);
foreach ($output as $key => $output_value) {
    echo json_encode($output_value);
foreach ($output as $key => $output_value) {
    echo json_encode($output[$key]);
var values = $("form").serialize();
type: 'POST',
data: values,
dataType: 'json',
foreach ($_POST as $value) {
    echo json_encode($value);

Jquery AJAX ($.get or $.ajax) HTML File retrieval, Manipulation, and JSON Send

Tag : javascript , By : user157064
Date : March 29 2020, 07:55 AM
To fix the issue you can do I'm facing an issue where I need to open an html file via Ajax, Modify it, and send it else where via ajax(JSON)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <body>  <div id="test">{message}</div>
function sendEmailFromTemplate(templateLocation) {
    $.get(templateLocation, function (data) { 

        data = data.replace(/({message})/g,"Here be my messagem");//putting message

        $.ajax({ //sends data
            type: "POST",
            url: "secretlocation.aspx",
            data: { fromEmail: "test@test.com", fromAbrv: "test", userEmail: $("#txtEmail").val(), message: data },
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {

            failure: function (response) {

Why function is undefined in ajax file - does function order matter in AJAX file?

Tag : php , By : desmiserables
Date : March 29 2020, 07:55 AM
hope this fix your issue This has nothing to do with Ajax.
From the PHP manual:

How to call function written in main file into ajax file in php & jquery

Tag : php , By : David
Date : March 29 2020, 07:55 AM
I wish this helpful for you if the function in the main page and you inject ajax to container inside it, the function need to be available for calling, in the end of the ajax file add function() //main function
you can also choose another approach after the ajax success you can call the function directly... by passing it as callback for example:

function ajax(url, callback, async) {
    var date = new Date();
    var ticks = date.getTime();

    if (url.indexOf('?') == -1)
        url = url + "?tick=" + ticks;
        url = url + "&tick=" + ticks;

        type: 'GET',
        url: url,
        dataType: 'html',
        async: async == undefined ? true : async,
        success: function (data) {

            if (data != undefined)

        error: function (xhr, textStatus, errorThrown) {
           //throw error

        complete: function () {


Related Posts Related QUESTIONS :
  • How to convert stream into variables in typescript
  • Three.js custom shader error on Chrome GL_INVALID_OPERATION: Active draw buffers with missing fragment shader outputs
  • My JavaScript doesn't work. How can I solve this problem?
  • Why is this async function is running synchronously?
  • Get updated variable from within react hook before return
  • I want to show all image preview but whenever I upload a new one the old one is gone
  • Would I be able to give access to specific electron APIs safely?
  • Why several clicks fire for each instance of a Class?
  • cant grab value from div using attr()
  • Make web service not accessible by browser?
  • Select DOM elements within template
  • How to customize angular ui-grid row background color?
  • Binding data in two respective $scope in AngularJS, how?
  • react put some props after import class
  • Variable is distributed among same components
  • switch class in jQuery/JavaScript for active/inactive state
  • How To Track Outbound Clicks Using Javascript
  • How to get total seconds elapsed since the beginning of the month?
  • Protractor: Stale element reference at "browser.wait(EC.visibilityOf(confDial), FIFTY_SECONDS);"
  • Access to an array inside an object
  • Reseting an JavaScript Interval with different value?
  • Learning Angular for the first time - version 2 or 4?
  • Rendering RSS feed (XML) in React with jquery, why do object values parsed from the feed seem empty?
  • Node.js xml2js http.request tag matching
  • applying texture to custom plane geometry in Threejs
  • How do I pass an Event as a function parameter in HTML written inside JavaScript variable?
  • Interface of object parameter with default value and default property
  • Does using try / catch rather than `.catch` observable operator with XHR requests reduce performance?
  • In IE11 background colors not working on printing
  • TypeScript interface signature "(): string"
  • Is synchronous XMLHttpRequest supported in Internet Explorer 10 and 11?
  • Axios function not returning any values with js
  • How to use firestore TIMESTAMP to create time-stamp in JavaScript
  • Instantiate subclass without constructing
  • Outputing a created object in javascript to a server side JSON file
  • Transition the numeric labels in a bar chart
  • createBottomTabNavigator: hide just one tab from the tabBar
  • iife vs simple statement behavior with document.title
  • showDialogPopup Refresh Page after Click
  • Child component does not set the initial value passed from the parent: ReactJS
  • Nodejs javascript added to button not responding
  • Trying to define a promise.all
  • Python GEE to extract featurecollection timeseries from Landsat imageries
  • How to write negative binary number?
  • Unable to set property of individual object
  • Why Named Function Expression itself cannot assign Name to another Value?
  • How to reset scroll position on single page pagination
  • How to scroll to bottom of page, when a new message is sent - Socket.io
  • How to reconstruct audio blob from a base64 encoded String?
  • How to calculate numbers within an array of objects
  • Using JavaScript to change CSS properties of SVG circles for all circles that was not clicked
  • Is there value in propTypeing repeat required properties at every level of nested components?
  • Call function if variable does not exist in a filter
  • localStorage value doesn't get updated automatically
  • React not updating state with setState correctly inside promises
  • Direct native JavaScript or jQuery method to get containing block of an element
  • Dynamic JSON object to Html Table
  • How to send Id and file to same controller?
  • How to Make a jQuery Table Cell(td) clickable to Run a Function?
  • Prevent the duplicate function onchange event jQuery
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com