fix: converted single to triple backticks11 (#36238)
This commit is contained in:
@@ -6,8 +6,9 @@ localeTitle: jQuery Ajax Post Method
|
||||
|
||||
يرسل طلب HTTP POST غير متزامن لتحميل البيانات من الخادم. شكله العام هو:
|
||||
|
||||
`jQuery.post( url [, data ] [, success ] [, dataType ] )
|
||||
`
|
||||
```javascript
|
||||
jQuery.post( url [, data ] [, success ] [, dataType ] )
|
||||
```
|
||||
|
||||
* url: هي المعلمة الإلزامية الوحيدة. تحتوي هذه السلسلة على العنوان الذي تريد إرسال الطلب إليه. سيتم تجاهل البيانات التي تم إرجاعها في حالة عدم تحديد أي معلمة أخرى
|
||||
* البيانات: كائن عادي أو سلسلة يتم إرسالها إلى الخادم مع الطلب.
|
||||
@@ -16,24 +17,27 @@ localeTitle: jQuery Ajax Post Method
|
||||
|
||||
#### أمثلة
|
||||
|
||||
`$.post('http://example.com/form.php', {category:'client', type:'premium'});
|
||||
`
|
||||
```javascript
|
||||
$.post('http://example.com/form.php', {category:'client', type:'premium'});
|
||||
```
|
||||
|
||||
طلبات `form.php` من الخادم ، وإرسال بيانات إضافية وتجاهل النتيجة التي تم إرجاعها
|
||||
|
||||
`$.post('http://example.com/form.php', {category:'client', type:'premium'}, function(response){
|
||||
alert("success");
|
||||
$("#mypar").html(response.amount);
|
||||
});
|
||||
`
|
||||
```javascript
|
||||
$.post('http://example.com/form.php', {category:'client', type:'premium'}, function(response){
|
||||
alert("success");
|
||||
$("#mypar").html(response.amount);
|
||||
});
|
||||
```
|
||||
|
||||
طلبات `form.php` من الخادم ، وإرسال بيانات إضافية والتعامل مع الاستجابة المرتجعة (تنسيق json). يمكن كتابة هذا المثال بهذا التنسيق:
|
||||
|
||||
`$.post('http://example.com/form.php', {category:'client', type:'premium'}).done(function(response){
|
||||
alert("success");
|
||||
$("#mypar").html(response.amount);
|
||||
});
|
||||
`
|
||||
```javascript
|
||||
$.post('http://example.com/form.php', {category:'client', type:'premium'}).done(function(response){
|
||||
alert("success");
|
||||
$("#mypar").html(response.amount);
|
||||
});
|
||||
```
|
||||
|
||||
يقوم المثال التالي بنشر نموذج باستخدام Ajax ووضع النتائج في div \`\` \`أتش تي أم أل jQuery.post التجريبي
|
||||
|
||||
@@ -41,8 +45,9 @@ localeTitle: jQuery Ajax Post Method
|
||||
|
||||
// Attach a submit handler to the form $( "#searchForm" ).submit(function( event ) { // Stop form from submitting normally event.preventDefault(); // Get some values from elements on the page: var $form = $( this ), term = $form.find( "input\[name='s'\]" ).val(), url = $form.attr( "action" ); // Send the data using post var posting = $.post( url, { s: term } ); // Put the results in a div posting.done(function( data ) { var content = $( data ).find( "#content" ); $( "#result" ).empty().append( content ); }); });
|
||||
|
||||
`The following example use the github api to fetch the list of repositories of a user using jQuery.ajax() and put results in a div
|
||||
`
|
||||
```
|
||||
The following example use the github api to fetch the list of repositories of a user using jQuery.ajax() and put results in a div
|
||||
```
|
||||
|
||||
أتش تي أم أل
|
||||
|
||||
|
||||
Reference in New Issue
Block a user