Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
systems:yii2:using_ajax [2018/05/31 11:08] smayr [Using JQuery $.get() or $.post()] |
systems:yii2:using_ajax [2018/05/31 11:16] (current) smayr [Using JQuery $.get() or $.post()] |
||
---|---|---|---|
Line 140: | Line 140: | ||
Using GET method: | Using GET method: | ||
<code php> | <code php> | ||
- | <?= $form-> | + | <?= $form-> |
- | | + | ' |
- | | + | ' |
//var aUrl = " | //var aUrl = " | ||
var aUrl = "' | var aUrl = "' | ||
Line 148: | Line 148: | ||
$( "# | $( "# | ||
}); | }); | ||
- | ']); | + | ', |
- | ?> | + | ]) ?> |
</ | </ | ||
Line 161: | Line 161: | ||
| | ||
url: aUrl, | url: aUrl, | ||
- | dataType: " | ||
data: {id: anId}, | data: {id: anId}, | ||
success: function( data ) { | success: function( data ) { | ||
Line 170: | Line 169: | ||
console.log(" | console.log(" | ||
console.dir( xhr ); | console.dir( xhr ); | ||
- | } | + | }, |
+ | dataType: " | ||
}); | }); | ||
', | ', | ||
Line 213: | Line 213: | ||
$( " | $( " | ||
.append( "Name: " + data.name ) // John | .append( "Name: " + data.name ) // John | ||
- | .append( "Time: " + data.time ); // 2pm | + | .append( "Time: " + data.time ); // 2pm |
}, " | }, " | ||
</ | </ |