Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x

AJAX

12K

Solutions

7K

Contributors

Asynchronous JavaScript and XML (AJAX) is a group of interrelated Web development techniques used on the client-side to create asynchronous Web applications. With AJAX, web applications can send data to and retrieve from a server asynchronously (in the background) without interfering with the display and behavior of the existing page. HTML and CSS can be used in combination to mark up and style information. The Document Object Model (DOM) is accessed with JavaScript to dynamically display and allow interaction with the information presented.

Share tech news, updates, or what's on your mind.

Sign up to Post

I have a page that is generated dynamically with a list of Press Releases.  There is another page that pulls the HTML via an AJAX call.  The problem is, is that the HTML page is dynamic.  Is there a way to populate the page before the AJAX call pulls the HTML?
0
Technology Partners: We Want Your Opinion!
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

say, I have an IFrame integration with an another website. when my site opens in this IFrame, i can make few JS calls to get the data from another site.

once I have the data (string data), I populate a hidden field in my page with this data. Now, how do i post this back to my controller, or what are few ways to do this?

can it be a ajax call ? so far, what I have in my html page is, a script that runs as soon as the page loads

 
<script type="text/javascript">
    (function () {
        try{
                document.getElementById("data").value = GetData();
            }
        }
        catch (e) {
            alert("error");
        }
    })();
</script>

Open in new window

0
I am using the below ajax to get some JSON from an API. Can someone tell me how I can add a timeout to this function? The fail only works if it fails the call right away.

Thank you.

  $.getJSON(foursquareURL).done(function (info) {
    var results = info.response.venues[0];
    if (typeof self.URL === 'undefined') {
      self.URL = '';
    }
    else {
      self.URL = results.url;
    }
    self.street = results.location.formattedAddress[0] || '';
    self.city = results.location.formattedAddress[1] || '';
    self.phone = results.contact.phone || '';
  }).fail(function () {
    $('.list').html('Error.');
  });

Open in new window

0
Never mind it works
0
I have the following ajax call and controller.   I am getting the error message indicating
the parameters dictionary contains a null value for parameter "allocation" of non nullable type decimal for method system.web.jsonresult UpdateContactEntity(System.string, system.decimal,system.string,system.string) in contact controller.  An optional parameter but be a reference type, a nullable type, or be declared as an optional parameter.

Here is my ajax:  Note all the alerts pull a value..so this must be in the ajax call itself..perhaps with url

function UpdateContactEntity(clientxcontactId) {
    var allocation = $("#txtAllocation_" + clientxcontactId).val();  
    var role = $('#selectRole_' + clientxcontactId +' :selected').text();  
    var designate =  $('#selectDesignate_' + clientxcontactId +' :selected').text(); 
    alert(allocation); 
    alert(designate);
    alert(role);   
    alert(clientxcontactId);
   $.ajax({
        url: "/Contact.mvc/UpdateContactEntity/ " + clientxcontactId + "?allocation=" +  allocation + "?role=" +  role + "?designate=" +  designate,
        type: 'GET',
        cache: false,
        dataType: 'json',
        data: { data: clientxcontactId },
        success: function (data) {
                var result = $.trim(data.Result);              
                ShowGridRedraw();
                },
        error: function (request, status, error) {
        alert(request.responseText);
        }     
     });
}

Open in new window


And here is the call to the controller:

[System.Web.Mvc.HttpGet]
        public JsonResult UpdateContactEntity(string id, decimal allocation, string role, string designate)
        {
            var result = true;
            int clientxcontactId = id.ToInt32();

            IContactEntityEditService contactEntityEditService = DependencyResolver.Current.GetService<IContactEntityEditService>();

            var updated = contactEntityEditService.UpdateContactClient(clientxcontactId,allocation, role, designate);

            result = updated;
            return Json(result, JsonRequestBehavior.AllowGet);
        }

Open in new window

0
I am trying to make an ajax  call...that will grab the values off the page...and then pass those values in the URL to the controller.

Here is the ajax...its crapping out on the 2nd line starting with var allocation.

function UpdateContactEntity(clientxcontactId) {
    var allocation = $("#txtallocation" + clientxcontactId + ).val();
    alert(allocation);       
   $.ajax({
        alert("test");
        url: "/Contact.mvc/UpdateContactEntity?clientxcontactId=" + clientxcontactId + "?allocation=" +  allocation,
        type: 'GET',
        cache: false,
        dataType: 'json',
        data: { data: clientxcontactId },
        success: function (data) {
                var result = $.trim(data.Result);              
                ShowGridRedraw();
                },
        error: function (request, status, error) {
        alert(request.responseText);
        }     
     });
}

Open in new window


For greater detail here is the other parts of my code:
Here is where I call it.

     [System.Web.Mvc.HttpGet]
        public JsonResult UpdateContactEntity(string data,int allocation)
        {
            var result = true;
            int clientxcontactId = data.ToInt32();
            IContactEntityEditService contactEntityEditService = DependencyResolver.Current.GetService<IContactEntityEditService>();

            var updated = contactEntityEditService.UpdateContactClient(clientxcontactId,allocation);

            result = updated;
            return Json(result, JsonRequestBehavior.AllowGet);
        }

Open in new window

0
Hi Experts,

Can any one help me get started to work with files in PHP?

For example, in order to upload a file, I think I need <input type="file">? I also think I need to add something to my <form> tag for this?

Finally, once submitted, how can I...
if folder/sub-folder !exist {
  create folder/sub-folder
}
save file as folder/sub-folder/filename

Open in new window


Thank you!
0
I'm echoing some data from PHP to ajax, then I tried to append the result to an existing div, but ajax is returning html markup codes instead. How can I make this work please?

Ajax

function comment(cmt) {
    if (document.getElementById("comments").value == "") {
        alert('You can\'t submit an empty comment');
        exit();
    }
    $(document).ready(function() {
        comments = document.getElementById('comments').value;
        var input_id = cmt.parentNode.firstElementChild;
        post_id = input_id.id.split('_')[0];
        post_tag = input_id.id.split('_')[1];
        $.ajax({
            url: "functions/comments.php",
            type: "POST",
            data: { post_tag: post_tag, post_id: post_id, comments: comments },
            dataType: 'html',
            success: function(result) {
                document.getElementById("comment-id").append(result);
            }
        });
        document.getElementById("comments").value = "";
        //fetchComment();
    });
}

Open in new window


PHP - comments.php
<?php
// some codes here...
$commentResponse .= '<div class="commentDisplay">';
    $commentResponse .= '<a href="http://localhost:8080/reminderapp/user_audio.php?u='.$row['commenter'].'">'.'<img id="commentersid" src="user/'.$row['username'].'/'.$row['avatar'].'" alt="'.$row['username'].'">';
        if($row['aliascheck'] == '1') {
            $commentResponse .= '<span id="commentName">'.$row['fullname'].'</span>'.'</a>';
        } else {
            $commentResponse .= '<span id="commentName">'.$row['alias'].'</span>'.'</a>';
        }
        $commentResponse .= '<span id="commentDate">'.$readabledate.'</span>';
        $commentResponse .= '<span id="commentWords">'.$row['user_comments'].'</span>';
        if($row['commenter'] == $log_username) {
            $commentResponse .= '<span id="deleteCmt">'.'<input id='.$comment_id.' class="deleteComt" type="button" title="Delete" value="x" onclick="deleteComment(this.id);" style="background-color:lightgray;"/>'.'</span>';
        }
        $commentResponse .= '</div>';
        $commentResponse .= '<br />';
}
echo $commentResponse;
?>

Open in new window


When the comment function is fired, the PHP spit out the whole html markup back to my page via the ajax append method.

I'm getting this returned to my page:
HTML markup
Below is what I want to see on my page:
Expected result
0
Next is from header:
 Select project from the list: <select id="selectProjectID" onfocus="onFocusSelectProject()">
                   </select></br></br>

Open in new window

And next is ajax call.
  function getLastOpenedProject(){  //_____________getLastOpenedProject(){ 
  $.ajax({
  method:"POST",
  url: '/wp-content/themes/net4/PgetJson.php',
  data:  {
      "getLastOpenedProject":1,
       "weGotTheuser":weGotTheuser
   datatype: "text",
    success: function(strdate){
         var selectProject3 = document.getElementById("selectProjectID");
      selectProject3.value=strdate;
      alert(strdate);
     }
  }); 
 }

Open in new window


"Alert" gives me right answer from DB.  What is then wrong in my code? I don't get anything in "select " element.
0
This is a map of the united states. I am using area coordinates to make hotspots on the map. When a user clicks the hotspot  I want to load info about that State into the div "myArea" using ajax. I have tried and tried, the Jquery is not binding to the link. Every time i click the area link it goes to the page instead of loading the page in the div with ajax.

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>MAP</title>
<link href="style.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript" src="jquery.maphilight.min.js"></script>




<script>
$(function() {
		$('.map').maphilight();
	});
		
</script>	


</head>

<body>


<img class='map' src="SitePad_Test.jpg" alt="" width="3840" height="2160" usemap="#Map"/>
<map name="Map">
  <area class="link" shape="poly" coords="1017,389,840,225,840,170,838,100,1071,101,1071,332" href="gpio.php?psh1" alt="build_1"  onclick="play()">
  <area class="link" shape="poly" coords="1057,427,1244,227,1247,104,1414,107,1411,204,1460,254,1184,558" href="gpio.php?psh2" alt="blding_2"  onclick="play()">
  <area class="link" shape="poly" coords="1076,596,927,733,824,638,835,354,1037,545" href="gpio.php?psh3" alt="building_3"  onclick="play()">
  <area class="link" shape="poly" coords="1677,379,1544,253,1546,86,1712,91,1713,176,1793,258" href="gpio.php?psh4" alt="building_4"  onclick="play()">
</map>
	

Open in new window

0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

So, here's my script:

<script>
$('#submit').click(function(event) {
		event.preventDefault();
		
		//if it returns a false, you'll get your error message. If it returns "true," you can then proceed to the rest of your form submission process
		var out = {
		'empID' : $('#empID').val(), 
		'cpID' : $('#cpID').val(), 
		'empName' : $('#empName').val(), 
		'custom_header' : $('#custom_header').val(), 
		'bodyTopColor' : $('#bodyTopColor').val(), 
		'bodyBottomColor' : $('#bodyBottomColor').val(), 
		'spanish_alert_yes' : $('#spanish_alert_yes').val()
		};
		
		$.post('employer_insert_execute.php?stage=phase_one', out, function(data)
		{
			$('.spanish_answer').show();
			$('#spanish_answer_cell').html(data);
		});

	});
</script>

Open in new window


Everything works right up to the point where I'm trying to upload an image file. Here's the way my code looks after successfully inserting a new record:

if($statement->execute())
			{
				
				$last_id = $conn->lastInsertId();
				//return id of record just inserted
				//upload logo and update record
				echo $_FILES['custom_header'];
				
				echo basename($_FILES[$parameters['custom_header']]);
				
				$target = "../Photos/"; 
				$target = $target . basename( $_FILES['custom_header']['name']) ;
				$url = basename($_FILES['custom_header']['name']); 
								 
				if(!move_uploaded_file($_FILES['custom_header']['tmp_name'], $target))
				{				
					return("photo didn't upload");
				}
				else 
				{
				$sql=$conn->prepare("update employers set header_graphic=:url where id=:id");
				$sql->bindParam(':url', $url, PDO::PARAM_STR);
				$sql->bindParam(':id', $last_id, PDO::PARAM_INT);
				
				if($sql->execute())
					{
						return("success");
					}
				}
			}
			else
			{
				return ("fail");
			}

Open in new window


I'm getting as far as "echo $_FILES['custom_header'] and it's apparent that the data that should be there - is not.

Based on what I've found at http://portfolio.planetjon.ca/2014/01/26/submit-file-input-via-ajax-jquery-easy-way/ as well as https://www.mattlunn.me.uk/blog/2012/05/sending-formdata-with-jquery-ajax/, it would seem that AJAX is going to process everything in the same way. So, when you get to a FILE, it struggles.

Here (apparently) is where you're going to use the formData object. Thing is, I don't know what that does or how to implement it.

In plain language, it sounds as thought JQuery is going to serialize incoming form data by default according to a certain way. Hence, when you're trying to upload image files, that $_FILE isn't going to work.

But what does formData do and how do I implement it here:


Open in new window

0
I can't seem to control the height of td and th in my bootstrap table or datatable.  Any help would be much appreciated!

Table:
http://www.gopherstateevents.com/results/cc_rslts/cc_rslts.asp?sport=Cross-Country

DataTable:
http://www.gopherstateevents.com/results/fitness_events/results.asp?event_type=5&event_id=666&race_id=1173

Thank you!
0
My PHP script returns an SQL error:
SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
whenever it cannot connect to the database to fetch the expected result.  This SQL error always comes up on my webpage and I would like to present it with something nice to my page  visitors. But my Ajax seems not to be working as it always comes up with that error each time I lost db connection. Below is my ajax:

function feedUpdate() {
    //$(document).ready(function() {
    $.ajax({
        type: 'POST',
        url: 'functions/feedUpdate_New.php',
        success: function(data) {
            if (data) {
                document.getElementById("homeFeed").innerHTML = data;
            } else {
                document.getElementById("homeFeed").innerHTML = "We are not able to get the feed at this time";
            }
        }
    });
    //});
}
feedUpdate();

Open in new window


NOTE: The PHP script is - feedUpdate.php and it contains the expected result. The above ajax returns the required result from the script if I have db connection. But once the db connection is lost, it pops up the sql error on the web page. Please how can I pick that sql error and present something like:
We are not able to get the feed at this time
0
We have an ASP.NET MVC 5 Question.  

What's is the best way to POST to an API.  Should this be done from the VIEW as an AJAX call OR should the POST be done from within the MVC Controller?
0
I have a modal div on a view, with a textbox and a button.  here is the javascript for the button click:

    $("#Search").on("click", function (e) {
        e.preventDefault();
        var address = $("#txtSa").val();
        var sa = address.replace(/ /g, "-");
        var frmData = new FormData();
        frmData.append("StreetAddress", sa);
        var url = "/Residents/SearchAddress"; ///" + sa;

        $.ajax({
            type: "POST",
            url: url,
            data: frmData,
            success: function (response) {
                alert(response);
            }
        });
    });

Open in new window


When this code executes I get the following script error:
jquery-3.1.1.js:8400 Uncaught TypeError: Illegal invocation
    at add (jquery-3.1.1.js:8400)
    at buildParams (jquery-3.1.1.js:8387)
    at Function.jQuery.param (jquery-3.1.1.js:8420)
    at Function.ajax (jquery-3.1.1.js:9010)
    at HTMLButtonElement.<anonymous> (Index:361)
    at HTMLButtonElement.dispatch (jquery-3.1.1.js:5201)
    at HTMLButtonElement.elemData.handle (jquery-3.1.1.js:5009)
add @ jquery-3.1.1.js:8400
buildParams @ jquery-3.1.1.js:8387
jQuery.param @ jquery-3.1.1.js:8420
ajax @ jquery-3.1.1.js:9010
(anonymous) @ Index:361
dispatch @ jquery-3.1.1.js:5201
elemData.handle @ jquery-3.1.1.js:5009

Open in new window


I am calling a controller action below, but it never reaches the controller:
[HttpPost]
        public ActionResult SearchAddress(string StreetAddress)
        {
            string result = "no";

            string address = StreetAddress.Replace("-", " ");

            Resident res = db.Residents.AsNoTracking().Where(r => r.StreetAddress.Equals(address)).FirstOrDefault();

            if (res != null)
            {
                result = "yes";
            }

            return Content(result);
        }

Open in new window


I don't know what I'm doing wrong here.
0
Hi,

I have a problem showing the Data Tables searchfield. I have tried everything I can think of, but it does not show.
What am I doing wrong.

The page is this: http://kroweb.dk/gfdev/ft_raw2/

I have this main code:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Folketællinger</title>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="style.css">


    <script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.min.css" />


    <script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.16/datatables.min.js"></script>

  <script type="text/javascript" src="jquery.dataTables.js"></script>
  <script type="text/javascript">
    $(document).ready(function() {
        $('#myTable').dataTable( {
          responsive:true
            "language": {
                "url": "dataTables.danish.lang"
            }
        } );
    } );
</script>

    <script type="text/javascript">
    $(function(){
        $('#ft_items').on('click', '.toggle', function() {
            

Open in new window

0
On the codeigniter side the post data isn't being received.  PHP is however receiving it.

Here is the ajax call
   
    var postData = {
        'partNumber' : '45367'
    }
axios.post('http://localhost/stuff/index.php/admin/reactTestaroo', postData)
        .then(response => renderTheTestData(response.data))

Open in new window


Here is what is in my PHP/CI controller:
    function reactTestaroo(){
        $entityBody = file_get_contents('php://input'); // just as a test I used this and it returns "{'partNumber':'45367'}" which seems to indicate it's being passed fine
        $pastNumber = $this->input->post('partNumber'); // returns NULL, this is the problem.. it should show the part number value.  
    }

Open in new window


I can use jQuery ajax all day long and it works fine like this:
    $.ajax({
        url: 'http://localhost/stuff/index.php/admin/reactTestaroo',
        data: postData,
        type: 'POST',
        success: function(response) {
        var parsedJSON = $.parseJSON(response);
        renderTheTestData(parsedJSON.part_name)
        },
        error: function(response){
            alert('nope');
        }
    });

Open in new window

With jQuery it works every time but I want to ditch jQuery and use react and a ajax plugin like axios but clearly I'm having an issue with it.  Can someone help me get the ajax via axios working?
0
I have an ASP.NET MVC Web API project using an AJAX script that POST data to my database.  This script includes a simple "success" and "error" function that returns a console.log message so I know if the script worked.  

This AjAX call works and the data from the form is being Posted (Inserted) into the database.  Great!

However... The AJAX code executes the "error" function even when the post is successful for some reason and I cannot figure out why.

Here's my code...

AJAX
$.ajax({
                    url: "/api/simpleEvents",
                    method: "post",
                    data: formData,
                    success: function (data) {
                        console.log("Yeah!  It worked.");
                        console.log(data);
                    },
                    error: function (result) {
                        console.log("Something unexpected happened.");
                        console.log(result.status + ' ' + result.statusText);
                    }
                });

Open in new window


Here's my controller.
        // POST /api/SimpleEvents
        [HttpPost]
        public IHttpActionResult CreateNewSimpleEvent(SimpleEventDto simpleEventDto)
        {
            if (!ModelState.IsValid)
                return BadRequest();

            var newSimpleEvent = Mapper.Map<SimpleEventDto, SimpleEvent>(simpleEventDto);

            _context.SimpleEvents.Add(newSimpleEvent);
            _context.SaveChanges();

            simpleEventDto.Id = newSimpleEvent.Id;

            return Created(new Uri(Request.RequestUri + "/" + newSimpleEvent.Id), simpleEventDto);
            
        }

Open in new window


What am I doing wrong?
0
Hi,

we need to Load external web site and show it as a live website tile in our application where x-frame-options set to same origin for the external website.

We followed below approaches but nothing is working.

Please help us to know any framework/approach to achieve this.

Iframe : < iFrame src="www.xyz.com">

Ajax Approach : Ajax HttpGet Call to the external web siteand get the html and render on our website.But replacing the image, css and html links from html is not working properly.


Web Request Approach : Server side HttpGet Call to the external web siteand get the html and render on our website.But replacing the image, css and html links from html is not working properly.
0
What does it mean to be "Always On"?
LVL 5
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

I attached illustration there is result of  code snippets below: string with user names (ivan4joni) and two users avatars .
I have two users : ivan4 and joni. As I have a while loop in php, I get names together as one string.

What would be the code for ajax to get a javascript variable as array [ ivan4 , joni]?
I don't need  users to be displayed as array on main page but as a array which will be then used in js functions.

  $.ajas x({
  method:"POST",
  url: '/wp-content/themes/net4/usersOnMainPageAjax.php',
  data:  {
      "querry2":1,
      "actualproject": whichProjectToSave
   },
   datatype: 'text',
    success: function(strdate){
   
  $('#usersWindowID > p').html(strdate);
     },
     error: function(error, txtStatus) {
      console.log(txtStatus);
      console.log('error');
    }
  });  

Open in new window


<?php
while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
$partners_username=...............;
$partnersHTML=...............; 
echo $partners_username;
}
echo $partnersHTML;  
?>

Open in new window


In general I need to learn how to get two variables with ajax from php.
partners.png
0
Hi I am trying to move the db and table parts of this page: http://kroweb.dk/gfdev/ft_raw2/index_test.php to Ajax.  

I get this error saying that there is undefines indexes which I don't quite understand since it is working when having it all in the same php file.

Notice: Undefined index: query_start in /var/www/kroweb.dk/public_html/gfdev/ft_raw2/ajaxFtHtml.php on line 32

Notice: Undefined index: sogn in /var/www/kroweb.dk/public_html/gfdev/ft_raw2/ajaxFtHtml.php on line 33

Notice: Undefined index: amt in /var/www/kroweb.dk/public_html/gfdev/ft_raw2/ajaxFtHtml.php on line 34

Notice: Undefined index: type in /var/www/kroweb.dk/public_html/gfdev/ft_raw2/ajaxFtHtml.php on line 35


I really need a little help to get this setup right :) :)

I have this primary file (index_test.php):
                    <!DOCTYPE html>
                    <html lang="en">
                    <head>
                        <meta charset="utf-8">
                        <title>Folketællinger</title>

                        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
                        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
                        <link rel="stylesheet" type="text/css" href="style.css">

                        <script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
                    

Open in new window

0
I have an ASP.NET MVC form that I'm trying to validate using JQueryVal.   The API controller works as I've tested in Postman successfully.  My problem is this.

The field validators work, however when the form IS valid it does not POST to the API and create a new record in my database table.

Instead it redirects you to the same page with the Form data in the querystring as parameters.

Here's my View that includes my AjAX/Jquery script.

@model ClienteManagment.ViewModels.IntakeFormViewModel

@{
    ViewBag.Title = "IntakeForm";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/jquery.validate.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.js"></script>

<h2>Intake Form</h2>

<form id="newIntake">

    <div class="form-group">
        @Html.LabelFor(m => m.Intake.ItemName)
        @Html.TextBoxFor(m => m.Intake.ItemName, new { @class = "form-control" })
        @Html.ValidationMessageFor(m => m.Intake.ItemName)
    </div>

    <div class="form-group">
        @Html.LabelFor(m => m.Intake.ItemDescription)
        @Html.TextBoxFor(m => m.Intake.ItemDescription, new { @class = "form-control" })
        @Html.ValidationMessageFor(m => m.Intake.ItemDescription)
    </div>

    <div class="form-group">
        @Html.LabelFor(m => m.Intake.Segment)
        @Html.DropDownListFor(m => m.Intake.SegmentId, new SelectList(Model.Segment, "Id", "Name"), "Select Segment", new { @class =

Open in new window

0
Hi - I need help.  I'm new to MVC development and RESTful API architecture and could use some help.

Here's an an example of my URL:

www.mysite.com/customer/details/1

In the details View I want to make a GET AJAX call to my web API that passes that "1" parameter to the GET method.  

How do I pass that parameter (1) to the VIEW to call the API to GET the data?
0
Hi Experts,

How Do I Call PHP from JS/JQuery?  I'm thinking AJAX?

A common example is "Load More Results", where without refreshing the page, I use a jquery listener to call a PHP function (or, if I cannot be as specific, then a PHP page), that would return to the JS a JSON object.

In theory, this should  be  possible with AJAX, but how? as well, how wold I stop everything else from firing until this process is complete.

Thank  you!
0
Is there any way that I can modify this page so that the results will appear without clicking "View"?

http://www.gopherstateevents.com/results/fitness_events/results.asp?event_type=5&event_id=682&race_id=1201

Thank you!
0

AJAX

12K

Solutions

7K

Contributors

Asynchronous JavaScript and XML (AJAX) is a group of interrelated Web development techniques used on the client-side to create asynchronous Web applications. With AJAX, web applications can send data to and retrieve from a server asynchronously (in the background) without interfering with the display and behavior of the existing page. HTML and CSS can be used in combination to mark up and style information. The Document Object Model (DOM) is accessed with JavaScript to dynamically display and allow interaction with the information presented.