- Screen name: Tony Girgenti
Tony Girgenti's Profile
3 Posts
22 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- Hello,
I'm trying to figure what this one line does in the script at the end of the jQuery.post() documentation.var content = $( data ).find( "#content" );
I realize it creates a variable named content, but where is it getting it from?
There is no element in the example code with an id of content.
Also, is the ( data ) the same data that is returned by the $.post?
Any help would be gratefully appreciated.
Thanks,
Tony- 28-Apr-2018 09:16 AM
- Forum: Getting Started
Hello,
Can anyone tell me where is the best place to ask questions about my simple jQuery $.post script?
Thanks,
Tony- <!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function () {
$("button").click(function () {
alert("Button clicked")
$.post("https://secure.chinavasion.com/api/getProductDetails.php",
{
key: "This is my key.",
currency: "USD",
model_code: "CVNZ-9470-Black-2GEN"
},
function (data, status) {
alert("Data: " + data + "\nStatus: " + status);
},
{ dataType: "json" } )
.fail(function (response) {
alert('Errorxxx: ' + response.responseText);
});
});
});
</script>
</head>
<body>
<button>Send an HTTP POST request to a page and get the result back</button>
</body>
</html>
- 14-Oct-2017 09:57 AM
- Forum: Getting Started
Hello,
I'm fairly new to Jquery and javascript.
I'm trying to perform an asynchronous HTTP (Ajax) request using this function:- function updateProgressBar(){
$.ajax({
url: '../ExportImport/LakesideImportManager/MyProgressReporting',
dataType: 'json'
}).done(function(response){
$("#myProgressBar").val(response.completionPercent);
if(response.completionPercent == 100){
clearInterval(myInterval);
}
});
}
When I debug it using the F12 Developer tools in IE 11, it shows the url as "'url' is undefined".
Does the 'url: '../ExportImport/LakesideImportManager/MyProgressReporting'' in the $.ajax call have to point to a controller method(I'm using ASP MVC C#)?
Does the url method, "MyProgressReporting", have to be an ActionResult?
Is the url relative to the folder that contains the view where the $.ajax call is located?
Any help that anyone can provide to help me figure this out would be gratefully appreciated.
Thanks,
Tony- «Prev
- Next »
Moderate user : Tony Girgenti
© 2013 jQuery Foundation
Sponsored by and others.

