for(var i=1; i<=num_rows; i++)
{
$('#question-board').prepend('<div id=myID'+i' class=abc>'+ $.get("forum-data-retrieve.php", {q:i}); +'</div> <hr>');
}
dimanche 28 juin 2015
What is wrong with this syntax? how can i use $.get method inside prepend function?
AJAX can't received data to controller MVC
I send data by ajax to mvc controller. I get to the correct method but without data. I tried to get List<string> but its null
js code:
function sendDataCreateMilestone(parameters) {
$.ajax({
url: "/QRCNew/create",
type: "post",
dataType: "json",
data: JSON.stringify(parameters)
});
}
server:
here i revived all the time null
public ActionResult Create (List<string> ids, string collection)
{
do....
}
add AJAX on custom python browser
I have a custom browser but my AJAX don't work. (work on firefox and others browsers.)
#!/usr/bin/env python
import sys
import gtk
import webkit
DEFAULT_URL = '/var/www/profile.html' # Change this as you Wish
class SimpleBrowser: # needs GTK, Python, Webkit-GTK
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.window.connect('delete_event', self.close_application)
self.window.set_default_size(1366, 743)
self.window.set_position(0)
vbox = gtk.VBox(spacing=0)
vbox.set_border_width(0)
self.txt_url = gtk.Entry()
self.txt_url.connect('activate', self._txt_url_activate)
self.scrolled_window = gtk.ScrolledWindow()
self.webview = webkit.WebView()
self.scrolled_window.add(self.webview)
vbox.pack_start(self.scrolled_window, fill=True, expand=True)
self.window.add(vbox)
def _txt_url_activate(self, entry):
self._load(entry.get_text())
def _load(self, url):
self.webview.open(url)
def open(self, url):
self.txt_url.set_text(url)
self.window.set_title('007WallPaper')
self._load(url)
def show(self):
self.window.show_all()
#self.window.fullscreen()
def close_application(self, widget, event, data=None):
gtk.main_quit()
if __name__ == '__main__':
if len(sys.argv) > 1:
url = sys.argv[1]
else:
url = DEFAULT_URL
gtk.gdk.threads_init()
browser = SimpleBrowser()
browser.open(url)
browser.show()
gtk.main()
How can I "import" AJAX functionality into it ?
Python, scrapy: Unable to paginate dynamically generated links on website, using the link got from firebug
I am a complete newbie at python, scrapy and web scraping, this being my first learning project. I want to scrape multiple pages from this website using scrapy: http://ift.tt/1C0cyxT
The links seem to be generated using ajax. At the end of the page is the link to next page. Clicking on <2> or and checking the link generated on firebug, shows following request being generated:
GET directory?p=2&category=1&map[disable]=0&map[height]=500&map[list_height]=500&map[span]=5&map[style]=&map[list_show]=0&map[listing_default_zoom]=15&map[options][scrollwheel]=0&map[options][marker_clusters]=1&map[options][force_fit_bounds]=0&distance=0&is_mile=0&zoom=15&perpage=16&scroll_list=0&feature=1&featured_only=0&hide_searchbox=0&hide_nav=0&hide_nav_views=0&hide_pager=0&template=&grid_columns=4&sort=title
So I thought, in my limited understanding, that if i replace p={pagenum} with any page number, that should get me the required page. I tried using the following url to directly request for the page:
However, this link generates an error page saying "page not found".
Can anyone help me understand what am I doing wrong here?
Thanks for your guidance.
could not get data from file by ajax with jquery datatable
I use the sample here:http://ift.tt/1RK9fwf
Below is my html and jquery code
<html>
<head>
<link rel="stylesheet" type="text/css" href="jquery-dataTables.css">
<script type="text/javascript" charset="utf8" src="jquery-min.js"></script>
<script type="text/javascript" charset="utf8" src="jquery-dataTables.js"></script>
<script>
$(document).ready(function() {
$('#example').dataTable( {
"ajax": "data/test.txt",
"columns": [
{ "data": "name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "extn" },
{ "data": "start_date" },
{ "data": "salary" }
]
} );
} );
</script>
</head>
<body>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
</table>
</body>
</html>
This is the structure of my file
But it couldn't load data into datatable, anyone can help?
Edit (Attach my test data): this data is used for
"data": [ { "name": "Tiger Nixon", "position": "System Architect", "salary": "$320,800", "start_date": "2011/04/25", "office": "Edinburgh", "extn": "5421" }, { "name": "Garrett Winters", "position": "Accountant", "salary": "$170,750", "start_date": "2011/07/25", "office": "Tokyo", "extn": "8422" }, { "name": "Ashton Cox", "position": "Junior Technical Author", "salary": "$86,000", "start_date": "2009/01/12", "office": "San Francisco", "extn": "1562" }, { "name": "Cedric Kelly", "position": "Senior Javascript Developer", "salary": "$433,060", "start_date": "2012/03/29", "office": "Edinburgh", "extn": "6224" },
{ "name": "Cara Stevens", "position": "Sales Assistant", "salary": "$145,600", "start_date": "2011/12/06", "office": "New York", "extn": "3990" },
{ "name": "Donna Snider", "position": "Customer Support", "salary": "$112,000", "start_date": "2011/01/25", "office": "New York", "extn": "4226" } ]
Thanks
Simple ajax in laravel 4
i have following code
ajax
//ajax edit button
$('.edit_button').on('click', function(e) {
var id_produk = $(this).attr('id');
$.ajax({
type : "POST",
url : "editproduk",
data : id_produk,
dataType: 'JSON',
success : function(data) {
alert('Success');
console.log(data);
},
error: alert('Errors')
});
});
i always get messagebox error
and don't know where i'm missing,
because in chrome - inspect element - console not give any clue
my route
Route::post('/account/editproduk', array(
'as' => 'edit-produk-post',
'uses' => 'AccountController@postEditProduk'
));
my controller
public function postEditProduk() {
if (Request::ajax()) {
return "test test";
}
}
ajax popup display center in body
I want to load my popup center in body.. i try to do that. but its not work.. here is my link : http://ift.tt/1IER9Hj (click Add to Cart button)
head style
<script src="http://ift.tt/1xDNnh9"></script>
<script src="http://ift.tt/1IER8Tw"></script>
<script src="http://ift.tt/1HpeT5C"></script>
Jquery
<script>
jQuery(function ($) {
$('.button').on('click', function () {
var id = $(this).data('id');
$.ajax({
url: '/shopping/ajax.php',
data: {
id: id
},
method: 'POST',
success: function (html) {
$('body').append(html);
$(html).bPopup();
},
error: function (returnValue) {}
});
});
});
</script>
button html
<button type="button" class="button small cart-button" data-id="2222">Add to Cart</button>
ajax.php file
<div id="popup">
<div class="inner">
<h2>Item added to your cart!</h2>
<!-- here some html and php codes -->
</div>
</div>