[Solved] Using $.post, $.ajax or AJAX properly in CodeIgniter to call a PHP script

Yes, you will need to put your file inside the libraries folder(if the class is separate from codeigniter or is shared among many controllers, if not a Model would suffice), then create a controller for it. class Ajax_Controller extends CI_Controller { public $statusCode = 200; public $response = array(); public function __construct() { parent::__construct(); if(!$this->is_ajax_request()){ … Read more

[Solved] jquery ajax fileupload [closed]

It is inevitable that you will have to use a “plugin” to your definition, but… Here’s the good news: There’s a really good, easy to use, simple to code jQuery-File-Upload by blueimp that you can Download Here. You wanted it simple: Since you are looking for it to be a simple, basic jQuery… You can … Read more

[Solved] calling a php function from a javascript script [duplicate]

You’ll need to call the PHP function from within the PHP page and print the result. Then connect to it with Javascript/AJAX to get the plain text the PHP prints. Example from w3schools. <script> function loadXMLDoc(){ var xmlhttp; var response; if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ response=xmlhttp.responseXML; alert(response); } } xmlhttp.open(“GET”,”register.php”,true); … Read more

[Solved] I want to get Data from ajax call

just create another function below run it the way you want as follows. I think your english is letting you down here. function loadMaps(id) { var field = { id : id }; var field1 = { id : id }; jQuery.ajax(‘{% url “mapport.maps.product” %}’, { data : field, nextpage : field1, success: function(response, status, … Read more

[Solved] Javascript for a suggestion box that pops up as the user scrolls down the screen. [closed]

You don’t need a plugin. Try something like this jQuery: $(document).ready(function() { //Check to see if the window is top if not then display button $(window).scroll(function() { if ($(this).scrollTop() > 100) { $(‘.nextPost’).fadeIn(); } else { $(‘.nextPost’).fadeOut(); } }); }); .nextPost { background: lightgray; font-weight: bold; position: fixed; top: 5px; right: 5px; display: none; } … Read more

[Solved] Better to have ajax inside or outside for-loop or for-loop at the server side? Javascript [closed]

In general, if you need to load a bunch of small data, its better to have one server endpoint that returns the all the data. It’s simpler for the client side and avoids the overhead of many xhrs. If you have 100 tags, do you really want to invoke 100 xhrs to get them all, … Read more

[Solved] replace specific link to ******* [closed]

I’m assuming you mean something like (in Javascript): var links = document.getElementsByTagName(‘a’); for (var i = 0; i < links.length; i++) { if (links[i].href == “http://www.google.com/”) links[i].href = “http://www.blather.blorg/” } Tested and works on Firefox 3. 4 solved replace specific link to ******* [closed]

[Solved] how to send data from html form to php using ajax using upload also

function dataSubmit(formid){ //alert(formid); // $(‘.result’).html(‘<p style=”display:block; text-align:center;”><i class=”fa fa-refresh fa-spin fa-fw” aria-hidden=”true”></i><span class=”sr-only”>Process…</span> Processing</p>’); var action = $(formid).attr(‘action’); var fd = new FormData(); var file_data = $(‘input[type=”file”]’)[0].files; // for multiple files for(var i = 0;i<file_data.length;i++){ fd.append(“file_”+i, file_data[i]); } var other_data = $(‘form’).serializeArray(); $.each(other_data,function(key,input){ fd.append(input.name,input.value); }); $.ajax({ url: action, data: fd, contentType: false, processData: false, type: … Read more

[Solved] $.ajax to call php function not working

Thanks everyone for your input, they were all good ideas, but in the end, the issue ended up being an IDE issue with codeLobster. I removed the src=”” line from <script type=”text/javascript” src=”https://stackoverflow.com/questions/34077625/js/jquery.js”></script> and let the intellisense fill in the src=”https://stackoverflow.com/questions/34077625/js/jquery.js” I finally got it to see the script but I was still getting the … Read more