logo
down
shadow

AJAX POST return data not appearing


AJAX POST return data not appearing

Content Index :

AJAX POST return data not appearing
Tag : php , By : UnKnownUser
Date : November 28 2020, 01:01 AM


Comments
No Comments Right Now !

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

Share : facebook icon twitter icon

AJAX Post - Performed in JSP, need to return java based variables in the AJAX POST Success function


Tag : java , By : Marc
Date : March 29 2020, 07:55 AM
seems to work fine If you know the structure of the data that's coming in (you should!), create an object that the post data can be serialized to (I'm assuming myData is json?... if not, it should be!) by the servlet. The spring framework provides the @RequestBody annotation to deserialize the incoming json to your object. When the servlet needs to respond, do what @Jigar recommended: wrap your response in an object. The spring framework provides the @ResponseBody annotation to serialize your response to json. It could look something like this:
Your js:
var myData = { postId: 1, comment: "this is great!" };
 $.ajax({ 
        type:        "POST", 
        url:           url, 
        dataType:  "text",  // [text, xml, json, script, text, html]
        data:       {postData : myData, sendURL : postUrl}, 
        success:    function(data, textStatus, jqXHR) {
            var jsonRepsonse = JSON.parse(data);
            alert('Success post to URL entered \n\n The data returned the following: ' + jsonRepsonse.responseText + ", " + jsonRepsonse.responseCode);
        }, 
        error:function (xhr, ajaxOptions, thrownError){ 
            alert('Error xhr : ' + xhr.status); 
            alert('Error thrown error: ' + thrownError); 
        }
        //complete: alert('complete')                   
    });
class Comment {
  private long postId;
  private String comment;
  // getters & setters
}
class AjaxResponse{
 private String responseText;
 private String responseCode;
 //other stuff
}
 @RequestMapping("/postData")
 public @ResponseBody postData(Model model, 
             @RequestBody Comment comment,
             HttpServletRequest request) throws Throwable{

    String sendURL= request.getParameter("sendURL");

    System.out.println(this.getClass() + " : comment : " + comment.toString());

    /* Process data and formulate a response.... */

    AjaxResponse ajaxResponse = new AjaxResponse(processedResponseText, processedResponseCode);

    return ajaxResponse;
 }
class CommentResponse extends Comment {
   private long commentId;
   private Timestamp entryDateTime;
   // etc
}

class AjaxResponse{
 private CommentResponse commentResponse;
 private String responseCode;
 //other stuff
}

Ajax Post to PHP and Get Return Data


Tag : javascript , By : user179190
Date : March 29 2020, 07:55 AM
To fix the issue you can do You seem to try to access "slideStatus" but you are posting "sliderStatus".

why ajax post method return empty alert box when i tried to return data from controller file in codeigniter


Tag : javascript , By : user184415
Date : March 29 2020, 07:55 AM
With these it helps you cant alert $("#myform").serialize(); because this is an object instead of alert it try console.log($("#myform").serialize();) then open browser console and see what is printed
$.ajax({
 type: "POST",
       url: "<?php echo base_url(); ?>index.php/customer/viewCustomerData",
       data: dataString,
})
  .done(function( data ) {
    if ( console && console.log ) {
      console.log( "Sample of data:", data);
    }
  });

Ajax POST data not appearing in modal


Tag : javascript , By : Menno
Date : March 29 2020, 07:55 AM
it fixes the issue Update: I did some tinkering and got the table data to show.
In the stored procedure (GetDocUnderReviewDetails.cs) I commented out the line where DocBudgetId = @DocBudgetId and added where DocNumber = @DocNumber. I noticed that if I just commented out where DBI = then it showed all of the comments made for every modal, which was an issue I was dealing with earlier.
namespace BB360
{
    public partial class Sql
    {
        public const string GetDocUnderReviewDetails = @"

        select 
            DocBudgetId, 
            DocNumber, 
            ReviewBy, 
            convert(varchar, ReviewOn, 101) as ReviewOn, 
            isnull(ReviewComment, '') as ReviewComment 
            from DocBudgetReview 
            --where DocBudgetId = @DocBudgetId
            where DocNumber = @DocNumber
            order by ReviewOn desc   
        ";
    }
}
public ActionResult GetDocUnderReviewDetails(Guid docBudgetId, string docNumber)
        {
            var data = Common.GetBBDbExecutor().Query<BudgetReportingViewModel.ReviewRow>(Sql.GetDocUnderReviewDetails, new {
                docBudgetId,
                docNumber
            }).ToList();


            return Json(data);
        }

How to return data from an AJAX post from PHP?


Tag : php , By : Vasiliy
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • strtotime gives back false result to strings in an array
  • How to create Url that contain name and id laravel
  • Codeigniter: Models not working with an error: Undefined property: CI_Loader
  • How to use + or - operators as parameters in Doctrine prepared SQL statement?
  • How to run scrapy with url parameters from php on linux debian
  • Preg matching imgur.com links
  • Php - Code comparing value of database to the value send by android app
  • Laravel pagination object in javascript
  • Error in validating message of no votes PHP
  • Symfony site on Azure with ClearDB connection
  • Woocommerce upsell with checkboxes
  • How to login/logout with Hybridauth 3?
  • Convert INT number in PHP
  • php/mysql. selecting 2 common fields in 2 tables
  • Expand an string based on values in an array in PHP
  • When you absolutely have to manually escape SQL in CakePHP 3.4.7
  • Htaccess redirecting wrong page
  • Laravel Optional WHERE clause
  • PHP unpack overlfow variable memory limit
  • How to check the URL's structure using PHP preg_match?
  • PHP preg_replace - text will not be recognized
  • Show image from other domain without showing the domain name - PHP
  • How to run and watch local server at the same time?
  • Access form request from Observer laravel
  • single quote problem with preg_replace_callback
  • How to Create A Unique URL for each product enquiry form for Google Analytics Tracking
  • Laravel email configuration: what am I missing?
  • Assign indexed array values to multidimensional array?
  • Custom WordPress stylesheet not loading
  • Data attribute only returning first value
  • How to list all roles with Permissions,in spatie permission Package?
  • How to achieve this number pattern with n input
  • How to iterate array inside array data in laravel ,output are given below
  • To get output of movie with its genre
  • Extracting some data from a JS object literal string in PHP using Regex
  • axios and vuex are deleting wrong index in array
  • Setting empty CURLOPT_POSTFIELDS
  • Laravel 5.8 use subdomain as API endpoint beside domain.com/api
  • Error while add data in database SQL Server 2016
  • Does PhpStorm allow to skip PHPDoc tags when type hints is declared?
  • html classes are changed to Attributes
  • Using json to import multidimensional data
  • passing data from the view to the controller, where the data comes from another controller
  • How to extract integer and decimal numbers in PHP string correctly?
  • Parsing Sub-Object from an XML Feed with objects
  • Getting error "Unknown column 'text' in 'field list'"
  • How to properly get onedrive access token via php and curl
  • How to add spell check to a php function
  • Is it posible to create css rules with php?
  • Pretty URL with $_GET method
  • Wordpress always load same page - index.php
  • Find value in array and return with new from different array
  • PHP multiple file upload with different keys
  • Can't modify times one a time without weird errors
  • Get size of scraped image with domcrawler (Goutte)
  • Laravel - Ordering a collection of models
  • PHP Fatal error: Uncaught Error: Call to a member function setFetchMode() on boolean
  • Strict Standards: Only variables should be passed by reference in /main_dir/sub_dir/backup.php
  • Uncaught Google_Exception: (update) unknown parameter: 'copyRequiresWriterPermission'
  • Laravel 5 form does not redirect with old input
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com