How to call JQuery Ajax Post with querystring URL

I have a web page which is redirected from a another page and have a querystring in it. now this page is calling a Jquery AJAX call to do some other task. Page URL is like : http://localhost:1041/Inventory/Inventorydetail.aspx?invoiceid=3 now this page is calling a AJAX post to delete a record from the grid. $(".DeleteInvoiceLine").click(function() { //Get the Id of the record var record_id = $(this).attr("id"); var loc = window.location; // Ask user's confirmation if (confirm("Do you want to delete this record?")) { $.ajax({ type: "POST", url: loc + "/DeleteInvoiceLineEntry", //Pass the selected record id data: "{'args': '" + record_id + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msgstr) { var msg = $("#ctl00_ContentPlaceHolder1_success"); msg.html(msgstr.d);; } }); } return false; }); so when I call the AJAX call the page_Load event is called instead of the webmethod "DeleteInvoiceLineEntry". if I have my page without the querystring passed it works fine. could you please suggest me how I can call a AJAX call on the page which has a querystring data init. I tried it both way passing the static URL Not working url: "Inventorydetail.aspx?invoiceid=3/DeleteInvoiceLineEntry" Working (if there is no querystring data in the page) url: "Inventorydetail.aspx/DeleteInvoiceLineEntry" Thanks for your quick help.

以上就是How to call JQuery Ajax Post with querystring URL的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准