Wordpress built in functions cant be recognize on ajax php file

Wordpress built in functions cant be recognize on ajax php file

By : Ansh Bahri
Date : November 18 2020, 01:01 AM
To fix this issue You can't call ajax like this, you have to call admin-ajax.php file through ajax url, and define a action take a look on this example:
code :
    url: 'admin-ajax.php', 
    type: 'post', 
    data: {action: 'my_action'}, 
    dataType: 'json'
// Call it in your themes functions.php file or in your plugin
add_action( 'wp_ajax_my_action', 'my_action_callback' );
function my_action_callback() {
    // Access more data through ajax request
    // any php method here to send the response

    // include your xxxecommerce.ajax.php file here and send response


Share : facebook icon twitter icon
AJAX Call - Does not recognize wordpress functions / classes

AJAX Call - Does not recognize wordpress functions / classes

By : Seydou Diallo
Date : March 29 2020, 07:55 AM
this will help You have written wrong ajax code. you can not use ajax like this. See below code:
code :
jQuery(document).ready(function($) {

 var dataString = {
                action: 'my_ajax',
                param: folio_data
                type: "POST",
                url: "<?php  echo admin_url('admin-ajax.php'); ?>",
                data: dataString,
                cache: false,
                success: function(msg)
                     $( '#ajax_folio' ).html( msg );
                    //alert( "Data Saved: " + msg );


 function ajaxDataSubmit(){
  global $wpdb; 
  $post_id = $_POST['param'];
   $counter = 0;
   global $wp_query ;
  $query = new WP_Query( array( 'post_type' => $post_type, 'post__in' => $post_id ) );
  if( $query->have_posts() ):
     $out .= '<table border = "1">';
   while( $query->have_posts() ):
            if( $counter == 6 ):
        $out .= '<tr class = "post_list">';
        $out .= '<td>'.get_the_post_thumbnail(get_the_ID(), array(100,100)).'<br>'.get_the_title().'</td>';

    if( $counter == 6 ):
    $out .= '</tr>';
    $counter = 0;

$out .= '</table>';
   $out = 'No Posts Found....';
add_action('wp_ajax_my_ajax', 'ajaxDataSubmit');//Logged in users
add_action('wp_ajax_nopriv_my_ajax', 'ajaxDataSubmit'); // Not logged in uNOTE: mer
Wordpress functions built into Notepad++

Wordpress functions built into Notepad++

By : Julie
Date : March 29 2020, 07:55 AM
may help you . Yes it is possibe, Please follow this article
How to make an ajax call to a php function with parameters in functions.php file Wordpress

How to make an ajax call to a php function with parameters in functions.php file Wordpress

By : Voina Alex
Date : March 29 2020, 07:55 AM
this one helps. You can access them, but not as the function parameters. They are in $_POST. So, $_POST['partnumber'] and $_POST['zipcode'].
IntelliJ does not recognize built-in java classes/functions

IntelliJ does not recognize built-in java classes/functions

By : George B
Date : March 29 2020, 07:55 AM
Does that help Your code is not within a method, but directly within your class definition:
code :
public class RequestHandler {  // DOES NOT COMPILE
  File file = new File("output.txt");

public class RequestHandler {
  File file = new File("output.txt");

  public void copyToOutput(InputStream in) {
    Files.copy(in, new FileOutputStream(file));
SQL safety when storing data using WordPress built-in functions

SQL safety when storing data using WordPress built-in functions

By : eknk
Date : March 29 2020, 07:55 AM
will be helpful for those in need meta values are sanitized using sanitize_meta, post content is sanitized through wp_kses_post, etc... You can safely assume that built-in functions are secure.
Related Posts Related Posts :
  • How to change add and remove active class in JavaScript
  • how to toggle a specific div in javascript
  • How to get all the values from multiple keys of an array of object?
  • jQuery bind() unbind() and on() and off()
  • regular expression to find DD Month YYYY from a string
  • How to upload files from web client (HTML/jQuery form) to your Dropbox folder
  • Backbone history and require.js issue
  • Confusion over Classical and Prototypal Inheritance Javascript
  • How to take screen shot of current webpage using Javascript/JQuery?
  • Store meridiem in a variable
  • class declared inside closure vs standard class without closure
  • javascript confirm box always return true
  • dynamically changing the size of font size based on text length using css and html
  • Node.js - Getting the host IP address while on Amazon EC2
  • Confusing CSS, can anyone explain please
  • How to install v8-profiler on Windows 8 (64 bit) using npm?
  • Resolve promise based on another promise
  • google maps adding overlay layer above UI and markers
  • Style specific letter?
  • RangeError: Maximum call stack size exceeded with array.slice
  • node rest client get with local variable
  • If condition not executes while mouse move fastly
  • Count the number of displayed elements in a HTML list
  • Locate JavaScript source code in Emacs
  • Clean, Modular Code vs MV* Frameworks
  • infinite scroll without loading image
  • Backbone: reverse collection order with comparator
  • What do printers ignore?
  • jQuery UI .tabs() Contentless tab?
  • Execute Javascript alert() after page (visually) loaded
  • JavaScript - duplicating array doesn't work
  • Excessive clickable area below image
  • JavaScript Regex: Replace |b| with <b>
  • Unexpected value change in 2D array in JavaScript
  • Function doesnt see parameter as a array of objects
  • jQuery fetch keypress event on chrome and IE
  • How to enable jquery validate localization?
  • Cassandra map collection returned by node.js Helenus looks odd
  • angular ng-repeat with multiple filter options
  • Selecting Children without ID or Class names
  • How to uncheck a group of checkboxes when another checkbox is checked
  • Is hiding content by Javascript or jQuery Worth trying
  • Load XUL resource using javascript
  • XML to HTML text area from server file system
  • set focus() on textbox on form onload
  • es lint '' is assigned a value but never used' eventhough i have used it
  • Can "name" attribute be used for custom VueJS components
  • Get innerHTML of content when it is clicked
  • HTTPS causes CSS animations to not load? Very confused
  • How to hide other div apart from touched div to the band
  • Is global variable assignment atomic on NodeJS?
  • Datepicker onchangemonthyear beforeshowday
  • trying to render html files using jade but it still adresses it as a jade
  • Google Analytics - Understanding and Dissecting the Snippet: What is | | [ ];
  • Replacing "[aA09.b]." to "[aA09.b]\n" in in JavaScript
  • Why wrap a function definition in an immediate function?
  • Enable / disable jQuery script on switching to different tab in a HTML page
  • how can find return variable value outside anonymous function in node js mysql query function
  • Converting 1 to 0001 in javascript array
  • svg viewbox should not resize the text fontSize?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org